Skip to content

FarazF19/RESTAPI_Project1

Repository files navigation

REST API Project

This project is a simple REST API for managing users, supporting CRUD operations. It utilizes MongoDB as the database and follows RESTful principles, with responses in JSON format. Through this project, I learned how to create a REST API, use MongoDB for database operations, and perform CRUD operations using the REST API. Additionally, I learned to use the MVC pattern and Postman to test the APIs. This project was a stepping stone towards learning Node.js.

Endpoints

Get All Users

  • GET /api/users
  • Retrieves a list of all users.

Get User by ID

  • GET /api/users/:id
  • Retrieves a user by their unique ID.

Create a New User

  • POST /api/users
  • Creates a new user.

Update a User by ID

  • PATCH /api/users/:id
  • Updates an existing user by their unique ID.

Delete a User by ID

  • DELETE /api/users/:id
  • Deletes a user by their unique ID.

Render HTML Document

  • GET /users
  • Renders an HTML document listing all users.

Getting Started

Prerequisites

  • Node.js
  • npm

Installing

  1. Clone the repository
    git clone https://github.com/FarazF19/RESTAPI_Project1.git

2. Navigate to the project directory
   ```bash
   cd RESTAPI_Project1
   ```
3. Install dependencies
   ```bash
   npm install
   ```

### Running the Server

```bash
npm start
```

The server will start on `http://localhost:4000`.

### Using the API

Use tools like `curl`, `Postman`, or any REST client to interact with the API endpoints.

## Authors

- Faraz

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgements

Special thanks to Piyush Gard for his YouTube tutorial series on Node.js which was instrumental in learning the concepts applied in this project. Check out his channel: [Piyush Gard YouTube Channel](https://www.youtube.com/watch?v=ohIAiuHMKMI&list=PLinedj3B30sDby4Al-i13hQJGQoRQDfPo&index=1)

```

```

Releases

No releases published

Packages

No packages published