Skip to content

A simple RESTful API for managing blog posts, built using Node.js and MySQL.

Notifications You must be signed in to change notification settings

Jai0401/blog-api

Repository files navigation

Blog API

The Blog API is a simple RESTful API for managing blog posts, built using Node.js and MySQL.

Table of Contents

Installation

  1. Clone this repository:
git clone https://github.com/Jai0401/blog-api.git
  1. Install dependencies:
cd blog-api
npm install
  1. Set up your environment variables (e.g., database connection details).
  2. Run migrations to create database tables:
npx sequelize-cli db:migrate

Usage

  1. Start the server:
npm start
  1. Access the API at http://localhost:3000.

Testing

npm test

Endpoints

  • GET /posts: Get a list of all blog posts.
  • GET /posts/:id: Get a specific blog post by ID.
  • POST /posts: Create a new blog post.
  • PUT /posts/:id: Update an existing blog post.
  • DELETE /posts/:id: Delete a blog post.

Checkout API Documentation for more details.