Toggle navigation
Toggle navigation
This project
Loading...
Sign in
khusat
/
khusat-server
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박기홍
2020-12-08 02:22:14 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a30c4bc5bd826fda52f2a1940798c84a575f3ace
a30c4bc5
1 parent
aca7bd5f
cors added
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
src/index.js
src/index.js
View file @
a30c4bc
const
express
=
require
(
'express'
);
const
app
=
express
();
//
const cors = require('cors');
const
cors
=
require
(
'cors'
);
const
port
=
8000
;
const
mongoose
=
require
(
'mongoose'
);
...
...
@@ -9,6 +9,14 @@ const bodyParser = require('body-parser');
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
app
.
use
(
bodyParser
.
json
());
// app.all('/*', function(req, res, next){
// res.header("Access-Control-Allow-Origin", "*");
// res.header("Access-Control-Allow-Headers", "X-Requested-With");
// next();
// })
app
.
use
(
cors
());
const
db
=
mongoose
.
connection
;
db
.
on
(
'error'
,
console
.
error
);
db
.
once
(
'open'
,
function
(){
...
...
Please
register
or
login
to post a comment