react-project/server/app.js

24 lines
450 B
JavaScript
Raw Normal View History

2024-02-28 12:42:50 +02:00
require('dotenv').config();
const express = require('express');
const path = require('path');
const app = express();
const port = 3001;
const session = require('express-session');
app.use(session({
resave: false,
saveUninitialized: false,
cookie: {
secure: process.env.SECURE === 'true',
}
}));
app.use(express.json());
app.listen(port, () => {
console.log(`Server running on http://localhost:${port}`);
});
module.exports = app;