/Express_API

A simple Express.js API that provides CRUD operations for a collection of posts. The below link is a free instance. Hence it needs some time to spin up:)

Primary LanguageJavaScriptMIT LicenseMIT

Express API

This project is a simple Express.js API that provides CRUD (Create, Read, Update, Delete) operations for a collection of posts. Note: This API is created for learning purposes and does not use any databases. It has an array of posts containing three static posts.

Table of Contents

Introduction

The Express API project is designed to serve as a backend for managing posts. It exposes various endpoints for interacting with post data, including retrieving posts, creating new posts, updating existing posts, and deleting posts.

Features

  • CRUD operations for posts
  • Simple and easy-to-understand code structure
  • Basic error handling

Getting Started

Follow these instructions to get the project up and running on your local machine.

Prerequisites

Ensure you have the following software installed:

  • Node.js
  • npm (Node Package Manager)

Installation

  1. Clone the repository:

     git clone https://github.com/NikhilKalloli/Express_API.git
    
  2. Navigate to the project directory:

    cd Express_API
    
  3. Install dependencies:

    npm install
    
  4. Start the server:

    node api.js
    

Usage

The API provides endpoints for managing posts. You can use tools like Postman or curl to interact with the API. Hosted url of API is here
Note: Send requests only to the configured endpoints.

API Endpoints

The following are the API endpoints provided by this Express API:

  • GET /posts: Retrieve all posts.

  • GET /posts/:id: Retrieve a specific post.

  • POST /posts: Create a new post.

  • PATCH /posts/:id: Update an existing post.

  • DELETE /posts/:id: Delete a post.

For detailed information on request and response formats, refer to the code comments.

Contributing

Contributions are welcome! If you have any improvements or new features to suggest, please create a pull request.

If you have any questions or issues, feel free to open an issue.

License

This project is licensed under the MIT License.

Connect with Me

Twitter LinkedIn

Feedback

If you have any feedback, please reach out to me at nikhilkalloli0097@gmail.com