forked from studioskim/skim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
36 lines (28 loc) · 861 Bytes
/
app.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
//const db = require("./skimWeb/config/db")
const express = require("express");
const naddress = __dirname + "/skimWeb";
const app = express();
const PORT = process.env.PORT || 3000;
app.use(express.static(naddress))
app.get("/", (req, res) => {
res.sendFile(naddress + "/index.html");
});
app.get("/skim_project", (req, res) => {
const request = req.query.num;
res.sendFile(naddress + "/skim_p" +request +".html");
});
app.get("/about", (req, res) => {
res.sendFile(naddress + "/skim_about.html");
});
app.get("/work", (req, res) => {
res.sendFile(naddress + "/skim_work.html");
});
//p1) get sensor value
app.get("/sensor", async (req, res) => {
const response = await db.sensor.getValue();
res.json(response);
});
app.listen(PORT, (err) => {
if (err) return console.log(err);
else console.log("서버 가동");
})