-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
26 lines (22 loc) · 796 Bytes
/
server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const express = require('express');
const cors = require('cors');
const apiRoutes = require('./routes/routes');
const path = require('path');
const favicon=require('express-favicon');
const morgan=require('morgan');
require('dotenv').config();
require('./config/conn')
const app = express();
app.use(express.query());
app.use(express.json());
app.use(morgan())
app.use(express.static(path.join(__dirname,'resources','client','build')))
app.use(favicon(path.join(__dirname, 'resources', 'client', 'build', 'favicon.png')));
app.use('/', apiRoutes);
app.get('/*', function(req, res) {
res.sendFile(path.join(__dirname, 'resources', 'client', 'build', 'index.html'));
});
const PORT = process.env.PORT || 5000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});