2023-02-13 02:16:46 +01:00
|
|
|
|
|
|
|
// do startup jobs
|
|
|
|
require('./startup');
|
|
|
|
|
|
|
|
const express = require('express');
|
|
|
|
const app = express();
|
2023-02-18 16:29:43 +01:00
|
|
|
const session = require('express-session');
|
|
|
|
const cookie_parse = require('cookie-parser');
|
|
|
|
const cookie_encrypt = require('cookie-encrypter');
|
2023-02-13 02:16:46 +01:00
|
|
|
|
2023-02-18 16:29:43 +01:00
|
|
|
const { APP_PORT, APP_KEY } = process.env;
|
2023-02-13 02:16:46 +01:00
|
|
|
|
|
|
|
app.use(require('./routes'));
|
2023-02-18 16:29:43 +01:00
|
|
|
app.use(express.static('public'));
|
|
|
|
|
|
|
|
app.use(cookie_parse(APP_KEY))
|
|
|
|
app.use(cookie_encrypt(APP_KEY));
|
|
|
|
app.use(session({
|
|
|
|
secret: APP_KEY,
|
|
|
|
cookie: { secure: true }
|
|
|
|
}));
|
2023-02-13 02:16:46 +01:00
|
|
|
|
|
|
|
const server = app.listen(APP_PORT, () => {
|
|
|
|
console.log("Listening on port " + APP_PORT);
|
|
|
|
});
|