Files
news-server/server/server.js
T
Ratstail91 99dfaddf04 Updated libraries, docker engine version, docker distro version
This also officially publishes the changes from @eels.
Sorry it took so long.
2023-12-23 23:36:18 +11:00

28 lines
617 B
JavaScript

//environment variables
require('dotenv').config();
//create the server
const express = require('express');
const app = express();
const server = require('http').Server(app);
//config
app.use(express.json());
//database connection
const database = require('./database');
//access the news
app.use('/news', require('./news'));
//error on access
app.get('*', (req, res) => {
res.redirect('https://github.com/krgamestudios/news-server');
});
//startup
server.listen(process.env.WEB_PORT || 3100, async (err) => {
await database.sync();
console.log(`listening to localhost:${process.env.WEB_PORT || 3100}`);
});