-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (25 loc) · 989 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
28
29
30
31
32
const express = require("express");
const cors = require("cors");
const cookieParser = require("cookie-parser");
const bodyParser = require("body-parser");
require("dotenv").config();
const app = express();
const port = 3000;
// TODO: Check if this is still needed
app.use(bodyParser.json({ limit: "10mb" })); // Adjust the limit as needed
app.use(bodyParser.urlencoded({ limit: "10mb", extended: true }));
app.use(cors({
origin: 'http://localhost:5173', // Allow requests from local frontend URL
credentials: true, // Allow cookies to be sent with requests
}));
app.use(cookieParser());
app.use(express.json());
const spotifyRoutes = require("./routes/spotifyRoutes");
const playlistRoutes = require("./routes/playlistRoutes");
const authRoutes = require("./routes/authRoutes");
app.use("/spotify", spotifyRoutes);
app.use("/playlists", playlistRoutes);
app.use("/auth", authRoutes);
app.listen(port, () => {
console.log(`Server is running on http://localhost:${port}`);
});