-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
51 lines (44 loc) · 2 KB
/
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
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 cors = require("cors");
const pet_routes = require("./routes/pet-routes");
const user_routes = require("./routes/user-routes");
const parttimecaretaker_routes = require("./routes/parttimecaretaker-routes");
const fulltimecaretaker_routes = require("./routes/fulltimecaretaker-routes");
const caretaker_routes = require("./routes/caretaker-routes");
const caretaker_bid_routes = require("./routes/caretaker-bid-routes");
const caretaker_availabilities_routes = require("./routes/caretaker-availabilities-routes");
const caretaker_basedaily_routes = require("./routes/caretaker-basedaily-routes");
const petowner_bid_routes = require("./routes/petowner-bid-routes");
const petowner_routes = require("./routes/petowner-routes");
const leave_routers = require("./routes/leave-routes");
const find_caretaker_routes = require("./routes/find-caretaker-routes");
const create_bid_routes = require("./routes/create-bid-routes");
const { db_connection_string } = require("./settings");
const app = express();
app.use(cors());
app.use(express.json());
app.use(
express.urlencoded({
extended: true,
})
);
const port = process.env.PORT || 8080;
if (!db_connection_string) {
console.error("Please specify a connection string to a database!");
process.exit(1);
}
app.get("/", (req, res) => res.send("Hello World!"));
app.use("/pets", pet_routes);
app.use("/users", user_routes);
app.use("/petowners", petowner_routes);
app.use("/caretakers", caretaker_routes);
app.use("/fulltime_caretakers", fulltimecaretaker_routes);
app.use("/parttime_caretakers", parttimecaretaker_routes);
app.use("/users/leaves", leave_routers);
app.use("/caretakers/bids", caretaker_bid_routes);
app.use("/petowners/bids", petowner_bid_routes);
app.use("/availabilities", caretaker_availabilities_routes);
app.use("/find-caretakers", find_caretaker_routes);
app.use("/find-caretakers/bid", create_bid_routes);
app.use("/basedailys", caretaker_basedaily_routes);
app.listen(port, () => console.log(`Listening on port ${port}...`));