Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2021-1-capstone-design1
/
RIT_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
박권수
2021-05-05 16:33:20 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
778b2b295741fc01793a9c28dfdb3d826dc30d32
778b2b29
1 parent
75b36f3a
feat. main server completed
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
server/index.js
server/index.js
View file @
778b2b2
...
...
@@ -3,6 +3,7 @@ const Router = require('koa-router');
const
bodyparser
=
require
(
'koa-bodyparser'
);
const
Mongoose
=
require
(
'mongoose'
);
const
api
=
require
(
'./src/api'
);
require
(
'dotenv'
).
config
();
const
{
SERVER_PORT
,
MONGO_URL
}
=
process
.
env
;
...
...
@@ -10,22 +11,21 @@ const { SERVER_PORT, MONGO_URL } = process.env;
const
app
=
new
Koa
();
const
router
=
new
Router
();
const
api
=
require
(
'./src/api'
);
Mongoose
.
connect
(
MONGO_URL
,
{
useNewUrlParser
:
true
,
useUnifiedTopology
:
true
,
useCreateIndex
:
true
}).
then
(()
=>
{
console
.
log
(
'Mongo DB is connected
'
);
console
.
log
(
'Mongo DB is connected
: '
,
MONGO_URL
);
}).
catch
(
e
=>
{
console
.
log
(
e
,
error
);
})
app
.
use
(
bodyparser
());
router
.
use
(
'/api'
,
api
.
routes
());
app
.
use
(
router
.
routes
()).
use
(
allowedMethods
());
app
.
use
(
router
.
routes
()).
use
(
router
.
allowedMethods
());
app
.
listen
(
SERVER_PORT
,
()
=>
{
console
.
log
(
SERVER_PORT
,
'is connected'
);
console
.
log
(
'PORT : '
,
SERVER_PORT
,
'is connected'
);
})
\ No newline at end of file
...
...
Please
register
or
login
to post a comment