This project is a RESTful API built using Node.js, Express.js, and MongoDB.
It demonstrates both session-based and token-based authentication and follows the MVC architecture for clean code organization.
- CRUD operations with Express and MongoDB
- Session-based authentication
- JWT (token-based) authentication
- MVC architecture
- MongoDB integration via Mongoose
- Environment-based configuration
- Modular route handling
nodejs-api/
βββ application_note/ # Notes or documentation
βββ src/ # Main source code
β βββ controllers/ # Request handlers
β βββ models/ # Mongoose schemas
β βββ routes/ # API routes
β βββ middleware/ # Auth and other middleware
β βββ config/ # DB and app configuration
βββ .gitignore
βββ LICENSE
βββ README.md
βββ package.json
βββ package-lock.json
---
## βοΈ Installation & Setup
## Installation & Setup
1. Clone the repository:
git clone https://github.com/hariomgola/nodejs-api.git
cd nodejs-api
2. π¦ Install dependencies:
npm install
3. Set up MongoDB:
- Ensure MongoDB is running locally or provide a remote URI.
- Create a `.env` file at project root and set your variables (e.g., `MONGO_URI`, `JWT_SECRET`).
4. βΆοΈ Run the project:
- For production:
npm start
- For development (auto-reload):
npm run dev
## Dependencies
- express
- mongoose
- jsonwebtoken
- express-session
- dotenv
- bcryptjs
## Author
Created by Hariom Gola
Website: https://hariomgola.github.io/
Resume: https://hariomgola.github.io/resume/
## Status
Project is currently In Progress. Contributions and feedback are welcome!
## License
This project is licensed under the MIT License.