-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathindex.js
27 lines (22 loc) · 835 Bytes
/
index.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
const express = require("express");
const path = require("path");
const completed = require("./completed");
const recipes = require("./recipes/api");
const ingredients = require("./ingredients/api");
const app = express();
app.get("/", (_, res) => res.sendFile(path.join(__dirname, "./index.html")));
app.get("/style.css", (_, res) =>
res.sendFile(path.join(__dirname, "./style.css"))
);
app.get("/favicon.ico", (_, res) =>
res.sendFile(path.join(__dirname, "./favicon.ico"))
);
app.use(express.json());
app.use("/images", express.static("./images"));
app.use("/completed", completed);
app.use("/recipes", recipes);
app.use("/ingredients", ingredients);
app.get("/hello", (req, res) => res.json({ status: "ok" }));
const PORT = process.env.PORT || 3000;
app.listen(PORT);
console.log("listening on http://localhost:" + PORT);