Showing
1 changed file
with
7 additions
and
2 deletions
... | @@ -3,12 +3,16 @@ const Router = require("koa-router"); | ... | @@ -3,12 +3,16 @@ const Router = require("koa-router"); |
3 | const bodyParser = require("koa-bodyparser"); | 3 | const bodyParser = require("koa-bodyparser"); |
4 | const mongoose = require("mongoose"); | 4 | const mongoose = require("mongoose"); |
5 | const jwtMiddleware = require("./src/lib/jwtMiddleware"); | 5 | const jwtMiddleware = require("./src/lib/jwtMiddleware"); |
6 | +const api = require("./src/api"); | ||
7 | + | ||
8 | +require("dotenv").config(); | ||
9 | + | ||
6 | const app = new Koa(); | 10 | const app = new Koa(); |
7 | const router = new Router(); | 11 | const router = new Router(); |
8 | -require("dotenv").config(); | 12 | + |
9 | app.use(bodyParser()); | 13 | app.use(bodyParser()); |
10 | app.use(jwtMiddleware); | 14 | app.use(jwtMiddleware); |
11 | -const api = require("./src/api"); | 15 | + |
12 | const { SERVER_PORT, MONGO_URL } = process.env; | 16 | const { SERVER_PORT, MONGO_URL } = process.env; |
13 | 17 | ||
14 | router.use("/api", api.routes()); | 18 | router.use("/api", api.routes()); |
... | @@ -26,6 +30,7 @@ mongoose | ... | @@ -26,6 +30,7 @@ mongoose |
26 | .catch((e) => { | 30 | .catch((e) => { |
27 | console.log(e); | 31 | console.log(e); |
28 | }); | 32 | }); |
33 | + | ||
29 | app.listen(SERVER_PORT, () => { | 34 | app.listen(SERVER_PORT, () => { |
30 | console.log("Server is running on port", process.env.SERVER_PORT); | 35 | console.log("Server is running on port", process.env.SERVER_PORT); |
31 | }); | 36 | }); | ... | ... |
-
Please register or login to post a comment