7c09ac46da
The purpose of this branch is to bring this project in line with the JWT protcol that the microservice is using. For the time being, it's easier to get a stripped-down and stable build and replace the lost parts, one- by-one.
32 lines
761 B
JavaScript
32 lines
761 B
JavaScript
//environment variables
|
|
require('dotenv').config();
|
|
|
|
//libraries
|
|
const path = require('path');
|
|
|
|
//create the server
|
|
const express = require('express');
|
|
const app = express();
|
|
const server = require('http').Server(app);
|
|
const bodyParser = require('body-parser');
|
|
|
|
//config
|
|
app.use(bodyParser.json());
|
|
|
|
//database connection
|
|
const database = require('./database');
|
|
|
|
//send static files
|
|
app.use('/', express.static(path.resolve(__dirname, '..', 'public')));
|
|
|
|
//fallback to the index file
|
|
app.get('*', (req, res) => {
|
|
res.sendFile(path.resolve(__dirname, '..', 'public' , 'index.html'));
|
|
});
|
|
|
|
//startup
|
|
server.listen(process.env.WEB_PORT || 3000, async (err) => {
|
|
await database.sync();
|
|
console.log(`listening to localhost:${process.env.WEB_PORT || 3000}`);
|
|
});
|