Skip to content

Commit a8838e5

Browse files
Add files via upload
1 parent 7bbc871 commit a8838e5

25 files changed

Lines changed: 3741 additions & 0 deletions

hotel_Lords-backend-main/Chai-and-backend-main/package-lock.json

Lines changed: 1831 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "chai_backend",
3+
"version": "1.0.0",
4+
"description": "a backend at chai aur code",
5+
"main": "index.js",
6+
"type": "module",
7+
"scripts": {
8+
"dev": "nodemon -r dotenv/config --experimental-json-modules src/index.js"
9+
},
10+
"keywords": [
11+
"jaascript",
12+
"backend",
13+
"chai"
14+
],
15+
"author": "Yuvraj Tripathi",
16+
"license": "ISC",
17+
"devDependencies": {
18+
"nodemon": "^3.1.10",
19+
"prettier": "^3.6.2"
20+
},
21+
"dependencies": {
22+
"bcrypt": "^6.0.0",
23+
"cloudinary": "^2.7.0",
24+
"cookie-parser": "^1.4.7",
25+
"cors": "^2.8.5",
26+
"crypto-js": "^4.2.0",
27+
"dotenv": "^17.2.1",
28+
"express": "^5.1.0",
29+
"jsonwebtoken": "^9.0.2",
30+
"mongoose": "^8.17.0",
31+
"mongoose-aggregate-paginate-v2": "^1.1.4",
32+
"multer": "^2.0.2",
33+
"node-cron": "^4.2.1",
34+
"nodemailer": "^7.0.5"
35+
}
36+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import express from "express"
2+
import cors from "cors"
3+
import cookieParser from "cookie-parser"
4+
5+
const app = express()
6+
const allowedOrigins = [
7+
'http://localhost:5173',
8+
'https://lords-hotel.netlify.app'
9+
];
10+
11+
app.use(cors({
12+
origin: (origin, callback) => {
13+
// Allow requests with no origin (like curl or Postman)
14+
if (!origin || allowedOrigins.includes(origin)) {
15+
callback(null, true);
16+
} else {
17+
callback(new Error('Not allowed by CORS'));
18+
}
19+
},
20+
credentials: true
21+
}));
22+
app.use(express.json({limit:"16kb"}))
23+
app.use(express.urlencoded({extended:true, limit:"16kb"}))
24+
app.use(express.static("public"))
25+
app.use(cookieParser())
26+
27+
28+
// routes
29+
import userRouter from './routes/user.routes.js'
30+
// routes declaration
31+
app.use("/api/v1/users", userRouter)
32+
33+
// http:localhost:800/api/v1/users/register
34+
35+
36+
export {app}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const DB_NAME = "videotube"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { asyncHandler } from "../utils/asyncHandler.js";
2+
import { ApiError } from "../utils/ApiError.js";
3+
import { User } from "../models/user.model.js";
4+
import { ApiResponse } from "../utils/ApiResponse.js";
5+
6+
7+
export { };
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { asyncHandler } from "../utils/asyncHandler.js";
2+
import { ApiError } from "../utils/ApiError.js";
3+
import { ApiResponse } from "../utils/ApiResponse.js";
4+
5+
export {};
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
import { asyncHandler } from "../utils/asyncHandler.js";
3+
import { ApiError } from "../utils/ApiError.js";
4+
import { uploadOnCloudinary } from "../utils/Cloudinary.js";
5+
import { ApiResponse } from "../utils/ApiResponse.js";
6+
7+
8+
9+
export {
10+
11+
// getWatchHistory,
12+
// getUserChannelProfile,
13+
};

0 commit comments

Comments
 (0)