-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
38 lines (29 loc) · 1.04 KB
/
Copy pathserver.js
File metadata and controls
38 lines (29 loc) · 1.04 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
// Dependencies
// =============================================================
var express = require("express");
require('dotenv').config()
// Sets up the Express App
// =============================================================
var app = express();
var PORT = process.env.PORT || 8081;
// Requiring our models for syncing
var db = require("./models");
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
// Static directory to be served
app.use(express.static("dist"));
// USING CORS FOR TESTING
//==============================================================
const cors = require('cors')
app.use(cors())
//--------------------------------------------------------------
// Routes
// =============================================================
require('./routes')(app)
// Starts the server to begin listening
// =============================================================
db.sequelize.sync({ force: false }).then(function() {
app.listen(PORT, function() {
console.log("App listening on PORT " + PORT);
});
})