Version 1

This commit is contained in:
clement callaert 2023-11-01 03:00:47 +01:00
parent 31e8a4e726
commit 146d66b3ca
3 changed files with 2834 additions and 0 deletions

36
main.js Normal file
View file

@ -0,0 +1,36 @@
const path = require('path');
const express = require('express');
const session = require('express-session')
const sessionConfig = require('./config/session')
const mongoDBSessionStore = sessionConfig.createSessionStore(session)
const db = require('./data/database');
const demoRoutes = require('./routes/demo');
const authRoutes = require('./routes/auth');
const postsRoutes = require('./routes/posts');
const authMiddleware = require('./middlewares/auth-middleware');
const app = express();
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.use(express.urlencoded({ extended: false }));
app.use(express.static('public'));
app.use(session(sessionConfig.createSessionConfig(mongoDBSessionStore)))
app.use(authMiddleware);
app.use(demoRoutes);
app.use(authRoutes);
app.use(postsRoutes);
app.use(function(error, req, res, next) {
res.render('500');
})
db.connectToDatabase().then(function () {
app.listen(3000);
});

2771
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

27
package.json Normal file
View file

@ -0,0 +1,27 @@
{
"name": "site",
"version": "1.0.0",
"description": "site BDS Metz",
"main": "public/js/Titre_daccueil.js",
"directories": {
"doc": "doc"
},
"scripts": {
"start": "nodemon main.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"bson": "^6.2.0",
"connect-mongodb-session": "^3.1.1",
"ejs": "^3.1.9",
"express": "^4.18.2",
"express-session": "^1.17.3",
"mongodb": "^4.17.1",
"mongoose": "^6.12.2"
},
"devDependencies": {
"nodemon": "^3.0.1"
}
}