송용우

Init server directory

1 +SERVER_PORT=4000
...\ No newline at end of file ...\ No newline at end of file
File mode changed
1 +const express = require("express");
2 +const morgan = require("morgan");
3 +const app = express();
4 +require("dotenv").config();
5 +
6 +app.use(
7 + morgan("[:date[iso]] :method :status :url :response-time(ms) :user-agent")
8 +);
9 +app.use(express.json());
10 +app.use(express.urlencoded({ extended: false }));
11 +app.use("/api", require("./api"));
12 +
13 +app.listen(process.env.SERVER_PORT, () => {
14 + console.log("Server is running on port", process.env.SERVER_PORT);
15 +});
...@@ -5,9 +5,17 @@ ...@@ -5,9 +5,17 @@
5 "license": "MIT", 5 "license": "MIT",
6 "dependencies": { 6 "dependencies": {
7 "eslint-config-prettier": "^6.11.0", 7 "eslint-config-prettier": "^6.11.0",
8 - "express": "^4.17.1" 8 + "express": "^4.17.1",
9 + "fs": "^0.0.1-security",
10 + "morgan": "^1.10.0",
11 + "path": "^0.12.7"
9 }, 12 },
10 "devDependencies": { 13 "devDependencies": {
11 - "eslint": "^7.1.0" 14 + "eslint": "^7.1.0",
15 + "nodemon": "^2.0.4"
16 + },
17 + "scripts": {
18 + "start": "node src",
19 + "start:dev": "nodemon --watch src/ src/index.js"
12 } 20 }
13 } 21 }
......
This diff is collapsed. Click to expand it.