forked from trvsm/terrace-instock-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
27 lines (22 loc) · 730 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 app = express();
const PORT = process.env.PORT || 8080;
const cors = require("cors");
// setup middleware: CORS for client requests, express.json to handle data
app.use(cors());
app.use(express.json());
// home page
app.get("/", (req, res) => {
res.send(
"Welcome to Terrace's API for inStock. By Mahdi, Travis, Gurpreeet, and Leo."
);
});
// all warehouses routes
const warehouseRoutes = require("./routes/warehouseRoute");
app.use("/warehouses", warehouseRoutes);
// all inventory routes
const inventoryRoutes = require("./routes/inventoryRoute");
app.use("/inventories", inventoryRoutes);
app.listen(PORT, () => {
console.log(`running at http://localhost:${PORT}`);
});