forked from meetmakwana19/intelligence-hub-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
26 lines (20 loc) · 762 Bytes
/
server.js
File metadata and controls
26 lines (20 loc) · 762 Bytes
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
const express = require("express");
const router = require("./routes/index");
const app = express();
const cors = require("cors");
app.use(express.json());
// needed this middleware because the fetch() methods on the frontend was getting error of `blocked by CORS policy`
app.use(cors());
app.use("/profiles", router.profilesRouter);
app.use("/user-tone", router.userToneRouter);
app.use("/knowledge-base", router.knowledgeBaseRouter);
app.use("/frameworks", router.frameworksRouter);
app.get("/greeting", (req, res) => {
return res.send("Greetings from Intelligence Hub API.");
});
app.get("/", (req, res) => {
return res.send("Welcome to Intelligence Hub API.");
});
app.listen(3000, () => {
console.log("Intelligence Hub API is listening !");
});