-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from tanish35/master
Minor change
- Loading branch information
Showing
1 changed file
with
16 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
import express from 'express'; | ||
import { Request, Response } from 'express'; | ||
import cors from 'cors'; | ||
import cookieParser from 'cookie-parser'; | ||
import express from "express"; | ||
import { Request, Response } from "express"; | ||
import cors from "cors"; | ||
import cookieParser from "cookie-parser"; | ||
import "dotenv/config"; | ||
import userRoutes from './routes/userRoutes'; | ||
import userRoutes from "./routes/userRoutes"; | ||
|
||
import moderationRouter from './routes/mRuote'; | ||
|
||
import reviewRoutes from './routes/reviewRoutes'; | ||
import ratingRoutes from './routes/ratingRoute'; | ||
import moderationRouter from "./routes/mRuote"; | ||
|
||
import reviewRoutes from "./routes/reviewRoutes"; | ||
import ratingRoutes from "./routes/ratingRoute"; | ||
|
||
const app = express(); | ||
app.use(express.json()); | ||
const corsOptions = { | ||
origin: 'http://localhost:3001', | ||
origin: "http://localhost:3001", | ||
credentials: true, | ||
}; | ||
app.use(cors(corsOptions)); | ||
app.use(cookieParser()); | ||
|
||
|
||
app.use("/api/user", userRoutes); | ||
//actual path (/api/admin/reviews/approve) | ||
// body :-> {"content":"....."} | ||
app.use("/api/admin",moderationRouter); | ||
|
||
app.use("/api/review", reviewRoutes) | ||
app.use("/api/rating", ratingRoutes) | ||
app.use("/api/admin", moderationRouter); | ||
|
||
app.use("/api/review", reviewRoutes); | ||
app.use("/api/rating", ratingRoutes); | ||
|
||
app.get("/", (req: Request, res: Response) => { | ||
res.send("Backend is running"); | ||
}); | ||
|
||
app.listen(process.env.PORT, () => { | ||
console.log(`Server is listening on port ${process.env.PORT}`); | ||
}); | ||
}); |