Skip to content

πŸ”₯This project contains full fledged Node.js API using express as a framework. Also using session as well as token based authentication while saving and fetching data from mongo-DB πŸ”₯

License

Notifications You must be signed in to change notification settings

hariomgola/nodejs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Node.js API with Express & MongoDB

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.

Features

  • 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

Project Structure

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.

About

πŸ”₯This project contains full fledged Node.js API using express as a framework. Also using session as well as token based authentication while saving and fetching data from mongo-DB πŸ”₯

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published