mySQL
This commit is contained in:
25
server/app.js
Normal file
25
server/app.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const express = require('express');
|
||||
const session = require('express-session');
|
||||
const app = express();
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
// Load environment variables
|
||||
dotenv.config();
|
||||
|
||||
// Ensure that SESSION_SECRET is defined
|
||||
if (!process.env.SESSIONS_SECRET) {
|
||||
console.error('FATAL ERROR: SESSIONS_SECRET is not defined.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Middleware
|
||||
app.use(express.json());
|
||||
app.use(
|
||||
session({
|
||||
secret: process.env.SESSIONS_SECRET,
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
})
|
||||
);
|
||||
|
||||
module.exports = app;
|
||||
Reference in New Issue
Block a user