Showing
1 changed file
with
4 additions
and
4 deletions
| ... | @@ -3,6 +3,7 @@ const Router = require('koa-router'); | ... | @@ -3,6 +3,7 @@ const Router = require('koa-router'); |
| 3 | const bodyparser = require('koa-bodyparser'); | 3 | const bodyparser = require('koa-bodyparser'); |
| 4 | 4 | ||
| 5 | const Mongoose = require('mongoose'); | 5 | const Mongoose = require('mongoose'); |
| 6 | +const api = require('./src/api'); | ||
| 6 | 7 | ||
| 7 | require('dotenv').config(); | 8 | require('dotenv').config(); |
| 8 | const { SERVER_PORT, MONGO_URL } = process.env; | 9 | const { SERVER_PORT, MONGO_URL } = process.env; |
| ... | @@ -10,22 +11,21 @@ const { SERVER_PORT, MONGO_URL } = process.env; | ... | @@ -10,22 +11,21 @@ const { SERVER_PORT, MONGO_URL } = process.env; |
| 10 | const app = new Koa(); | 11 | const app = new Koa(); |
| 11 | const router = new Router(); | 12 | const router = new Router(); |
| 12 | 13 | ||
| 13 | -const api = require('./src/api'); | ||
| 14 | 14 | ||
| 15 | Mongoose.connect(MONGO_URL, { | 15 | Mongoose.connect(MONGO_URL, { |
| 16 | useNewUrlParser : true, | 16 | useNewUrlParser : true, |
| 17 | useUnifiedTopology: true, | 17 | useUnifiedTopology: true, |
| 18 | useCreateIndex : true | 18 | useCreateIndex : true |
| 19 | }).then(() => { | 19 | }).then(() => { |
| 20 | - console.log('Mongo DB is connected'); | 20 | + console.log('Mongo DB is connected : ', MONGO_URL); |
| 21 | }).catch(e => { | 21 | }).catch(e => { |
| 22 | console.log(e, error); | 22 | console.log(e, error); |
| 23 | }) | 23 | }) |
| 24 | 24 | ||
| 25 | app.use(bodyparser()); | 25 | app.use(bodyparser()); |
| 26 | router.use('/api', api.routes()); | 26 | router.use('/api', api.routes()); |
| 27 | -app.use(router.routes()).use(allowedMethods()); | 27 | +app.use(router.routes()).use(router.allowedMethods()); |
| 28 | 28 | ||
| 29 | app.listen(SERVER_PORT, () => { | 29 | app.listen(SERVER_PORT, () => { |
| 30 | - console.log(SERVER_PORT, 'is connected'); | 30 | + console.log('PORT : ', SERVER_PORT, 'is connected'); |
| 31 | }) | 31 | }) |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment