Design and implement a complete backend for a Hotel Management System using Node.js, Express, and MongoDB. The system should support User, Admin, and Staff roles and include authentication, logging, rate-limiting, and user verification.
This file contains hidden or 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
===================BACKEND============ | |
What is Node.js? | |
Definition: Node.js is an open-source, cross-platform JavaScript runtime built on Chrome’s V8 engine. | |
Purpose: Allows you to run JavaScript outside the browser — mainly for building servers, APIs, CLI tools, and real-time apps. | |
Key Feature: Event-driven, non-blocking I/O → handles many connections efficiently. | |
2009 – The Birth | |
Creator: Ryan Dahl |
This file contains hidden or 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
console.log("Hi") |
This file contains hidden or 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
export PS1='%{%F{green}%}%n@%m%{%f%}:%{%F{yellow}%}%~%{%f%}$ ' |
This file contains hidden or 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
ls | |
ls -a | |
these are the commands |
This file contains hidden or 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
Git and GitHub Setup | |
To Install Git In Ubuntu | |
1. sudo apt update && sudo apt install git -y | |
2. git --version | |
To Install Git In MacOS | |
1.brew install git |
This file contains hidden or 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
sudo chown -R $USER:$USER ~/.npm | |
sudo chown -R $USER:$USER node_modules package-lock.json | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" | |
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" | |
npm config delete proxy | |
npm config delete https-proxy | |
export PATH=$PATH:$(npm bin -g) |
This file contains hidden or 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
Steps for Deployment WebApp / Websites | |
1.Make sure you have webapp or website is working good at local | |
2.make a GitHub repo and push the code to GitHub without node_modules | |
3.Changes in GitHub Repo | |
- Add Description | |
- Add URL | |
- Add Keywords | |
- Add README.md |
This file contains hidden or 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
sudo apt install -y git | |
sudo apt install -y net-tools | |
sudo timedatectl set-timezone Asia/Kolkata | |
sudo apt-get install -y nginx | |
sudo apt install -y snapd | |
sudo snap install core | |
sudo apt-get install -y python3-certbot-nginx | |
sudo snap install --classic certbot | |
sudo ln -s /snap/bin/certbot /usr/bin/ | |
sudo apt install -y python3-pip |
This file contains hidden or 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
import express from "express"; | |
import fs from "fs"; | |
import path from "path"; | |
import { fileURLToPath } from "url"; | |
import config from "config"; | |
import cors from "cors"; | |
// Database connection | |
import "./utils/dbConnect.js"; |
NewerOlder