Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rahul-sahani04/userapimongo
A Node.js, Express, and MongoDB-based API for effortless user data management. Create, retrieve, update, and delete users with built-in authentication and authorization. Simplify user interactions while ensuring data security.
https://github.com/rahul-sahani04/userapimongo
api expressjs mongodb mongoose nodejs
Last synced: 10 days ago
JSON representation
A Node.js, Express, and MongoDB-based API for effortless user data management. Create, retrieve, update, and delete users with built-in authentication and authorization. Simplify user interactions while ensuring data security.
- Host: GitHub
- URL: https://github.com/rahul-sahani04/userapimongo
- Owner: Rahul-Sahani04
- License: mit
- Created: 2023-08-05T07:22:44.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-01T16:58:33.000Z (about 1 year ago)
- Last Synced: 2024-04-21T12:20:57.094Z (7 months ago)
- Topics: api, expressjs, mongodb, mongoose, nodejs
- Language: JavaScript
- Homepage: https://user-api-mongo.vercel.app
- Size: 66.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# User API for MERN Projects
This repository contains a User API built on top of MongoDB, designed to be integrated into MERN (MongoDB, Express, React, Node.js) stack projects or for other use cases. The API provides basic CRUD (Create, Read, Update, Delete) operations for managing user data.## Features
User Management: Perform CRUD operations on user data, including creating new users, fetching user details, updating user information, and deleting users.
Authentication: Secure endpoints with authentication to ensure only authorized users can access and modify user data.
Validation: Input data is validated to ensure integrity and consistency.
Scalable: Built on top of MongoDB, the API can handle a large number of users and is suitable for scaling up.## Prerequisites
Node.js and npm installed.
MongoDB server running.
Basic understanding of RESTful APIs.## Installation
Clone this repository.```bash
git clone https://github.com/Rahul-Sahani04/UserApiMongo
```
```bash
cd user-api
```Install dependencies.
```bash
npm install
```Configure environment variables.
## Start the server.
```bash
npm run dev
```## Usage
Register a new user:
Send a POST request to /api/users/register with user data in the request body.Login:
Send a POST request to /api/users/login with valid credentials. You will receive a JWT token upon successful login.### Access User Data:
Include the received JWT token in the Authorization header for authenticated routes to access user data.### CRUD Operations:
- Create: Send a POST request to /users/add with new user data.
- Read: Send a GET request to /users/search to fetch user details.
- Update: Send a PUT request to /users/:userId with updated user data.
- Delete: Send a DELETE request to /users/:userId to delete a user.## Contributing
Contributions are welcome! If you find any issues or improvements, feel free to open a pull request.## License
This project is licensed under the [MIT License](https://mit-license.org/).---
Happy coding!