Skip to content

augustinegyan/CRUD_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Simple CRUD API for a Blog

This project is a simple backend CRUD API built using Express, Node.js, and MySQL. It provides basic functionality to create, read, update, and delete blog posts.

Features

  • Create a new blog post
  • Retrieve a blog post by ID
  • Retrieve all blog posts
  • Update an existing blog post
  • Delete a blog post

Prerequisites

Before running the project, make sure you have the following installed:

Getting Started

  1. Clone the repository:

    git clone <repository-url>
    
  2. Install Dependecies if needed

    npm install express mysql2 dotenv
  3. Run Project

    npm start

API Endpoints

Use any API enpoints of your choice POSTMAN or ISONMIA anything goes

Create a Post

  • Endopoints => /posts
  • content to POST is json {title , content}
    {
    "title": "Title or Heading here",
    "content": "Content here"
   }

1

GET a Specific Data

  • Endopoints => /posts/:id
  • Output is an array of data of specific :id [{title , content}] (result[0])

3

GET All Post

  • Endpoint => /posts
  • Output is an array of all Blog Post

2

Update a Post

  • Endpoint => /posts/:id
  • Update Blog Post of a specific :id
  • content to PUT is json {title , content}
   {
   "title": "Update",
   "content": "Content here"
  }

4

Delete a Post

  • Endpoint => /posts/:id
  • Delete Blog Post of a specific :id

5

Database Creation

         CREATE DATABASE blog_database;

         USE blog_database;

 
         CREATE TABLE posts (
         id INT AUTO_INCREMENT PRIMARY KEY,
         title VARCHAR(255),
         content TEXT
          );

Kindly create this schema or database in your mySQL and link to the project

This project will be updated as times go on for better implication Authentication process is being worked on .. - Just got started with JS

About

A simple Blog CRUD API with mySQL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors