-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
37 lines (31 loc) · 959 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
const express = require("express");
const app = express();
const cors = require("cors");
const dotenv = require("dotenv");
const path = require("path");
// import routes
const insertion = require("./routes/insertion");
const bubble = require("./routes/bubble");
const merge = require("./routes/merge");
const quick = require("./routes/quick");
const radix = require("./routes/radix");
const selection = require("./routes/selection");
// use dotenv to load environment variables from .env file
dotenv.config();
// import dependencies
app.use(cors());
app.use(express.json());
app.get("/", (req, res) => {
res.send("");
});
////// time is in ms?
// routes
app.use("/insertion", insertion);
app.use("/bubble", bubble);
app.use("/merge", merge);
app.use("/quick", quick);
app.use("/radix", radix);
app.use("/selection", selection);
app.listen(process.env.PORT || 3000, () => {
console.log(`Server is running on port: ${process.env.PORT || 3000}`);
});