Commit 3272034b authored by Matthieu - Greep's avatar Matthieu - Greep

Add cookie-parser, morgan, eslint

parent 61714741
require('./socket'); require('./socket');
require('dotenv').config(); require('dotenv').config();
const express = require('express'); const express = require('express'),
const cors = require('cors'); cors = require('cors'),
const bodyParser = require('body-parser'); logger = require('morgan'),
const mysql = require('mysql'); cookieParser = require('cookie-parser'),
const events = require('./events'); mysql = require('mysql'),
//events = require('./events'),
path = require('path'),
fs = require('fs');
const connection = mysql.createConnection({ const connection = mysql.createConnection({
host : process.env.DB_HOST, host : process.env.DB_HOST,
...@@ -20,9 +23,11 @@ connection.connect(); ...@@ -20,9 +23,11 @@ connection.connect();
const port = process.env.PORT || 8080; const port = process.env.PORT || 8080;
const app = express() const app = express()
.disable('etag')
.use(cors()) .use(cors())
.use(bodyParser.json()) .use(express.json())
.use(events(connection)); .use(cookieParser())
.use(logger('(:date) :method :url - ":user-agent" (:remote-addr) - :status :response-time ms'));
app.listen(port, () => { app.listen(port, () => {
console.log(`Express server listening on port ${port}`); console.log(`Express server listening on port ${port}`);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -13,12 +13,15 @@ ...@@ -13,12 +13,15 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
"cookie-parser": "^1.4.5",
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^10.0.0", "dotenv": "^10.0.0",
"express": "^4.17.1", "express": "^4.17.1",
"morgan": "^1.10.0",
"mysql": "^2.18.1" "mysql": "^2.18.1"
}, },
"devDependencies": { "devDependencies": {
"eslint": "^7.32.0",
"nodemon": "^2.0.7" "nodemon": "^2.0.7"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment