-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (23 loc) · 649 Bytes
/
app.js
File metadata and controls
29 lines (23 loc) · 649 Bytes
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
const express = require("express");
const morgan = require("morgan");
const path = require("path");
const fs = require('fs')
const layout = require('./views/layout')
const { db } = require('./models')
const app = express();
app.use(morgan("dev"));
//Extended False = cannot post nested object
app.use(express.urlencoded({extended:false}));
app.use(express.static(path.join(__dirname, "public")));
db.authenticate()
.then(() => {
console.log('connected to the database');
})
//Default Route
app.get("/", (req, res) => {
res.send(layout(''));
})
const PORT = 1337;
app.listen(PORT, () => {
console.log(`App listening in ${PORT}`)
})