mirror of
https://github.com/pawelmalak/flame.git
synced 2025-06-28 17:23:03 -04:00
Docker build. Catch client routes on server. Initial config utility
This commit is contained in:
parent
d2e6ebae4f
commit
1636b705de
10 changed files with 125 additions and 13 deletions
12
server.js
12
server.js
|
@ -1,3 +1,4 @@
|
|||
require('dotenv').config();
|
||||
const http = require('http');
|
||||
const { connectDB } = require('./db');
|
||||
const api = require('./api');
|
||||
|
@ -5,12 +6,15 @@ const jobs = require('./utils/jobs');
|
|||
const Socket = require('./Socket');
|
||||
const Sockets = require('./Sockets');
|
||||
const associateModels = require('./models/associateModels');
|
||||
const initConfig = require('./utils/initConfig');
|
||||
|
||||
require('dotenv').config();
|
||||
const PORT = process.env.PORT || 5005;
|
||||
|
||||
connectDB();
|
||||
associateModels();
|
||||
connectDB()
|
||||
.then(() => {
|
||||
associateModels();
|
||||
initConfig();
|
||||
});
|
||||
|
||||
// Create server for Express API and WebSockets
|
||||
const server = http.createServer();
|
||||
|
@ -21,5 +25,5 @@ const weatherSocket = new Socket(server);
|
|||
Sockets.registerSocket('weather', weatherSocket);
|
||||
|
||||
server.listen(PORT, () => {
|
||||
console.log(`Server is running on port ${PORT} in ${process.env.NODE_ENV} mode`.yellow.bold);
|
||||
console.log(`Server is running on port ${PORT} in ${process.env.NODE_ENV} mode`);
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue