-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
32 lines (26 loc) · 1.01 KB
/
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
const express = require("express");
const cookieParser = require("cookie-parser");
const cors = require("cors");
const app = express();
const authController = require("./controllers/authController");
const fileController = require("./controllers/fileController");
const scrapeController = require("./controllers/scrapeController");
const authMiddleware = require("./middleware/authMiddleware");
const { server } = require("./controllers/graphqlController");
app.use(express.json());
app.use(cookieParser());
app.use(cors());
app.get("/", (req, res) => {
res.send({ user: "utkarsh" });
});
app.post("/login", authController.login);
app.post("/profile", authMiddleware, authController.profile);
app.post("/logout", authController.logout);
app.post("/upload", fileController.upload, fileController.uploadFile);
app.get("/scrape", scrapeController.scrape);
server.listen().then(({ url }) => {
console.log(`🚀 GraphQL Server ready at ${url}`);
});
app.listen(5001, () => {
console.log("App running on port 5001");
});