-
Notifications
You must be signed in to change notification settings - Fork 0
/
server.js
51 lines (39 loc) · 954 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const express = require("express");
const morgan = require("morgan");
const app = express();
const PORT = process.env.port || 3001;
const db = require("./models");
app.use(morgan('dev'))
// Sets up the Express app to handle data parsing
app.use(express.urlencoded({
extended: true
}));
app.use(express.json());
app.get("/profile", (req, res) => {
res.send("This is the profile page")
})
app.get("/profile/:id", (req, res) => {
res.send(`This is the profile for: ${req.params.id}`)
});
app.post("/api/new", (req, res) => {
res.json({
id: 1,
...req.body
});
})
app.get("/health", (req, res) => {
res.json({
success: true
})
})
// db.sequelize.sync().then(() =>{
// app.listen(PORT, () => {
// console.log(`App is listening on PORT:${PORT} 🚀`)
// })
// });
app.listen(PORT, () => {
console.log(`App is listening on PORT:${PORT} 🚀`)
})
module.exports.app = {
app
}