/Blog-API

A RESTful API for a simple blog platform

Primary LanguageTypeScript

Blog-API

This API allows you to create blog posts, update blog posts, delete blog posts and get all blog posts. It also includes a pagination feature that allows you to get a specific number of posts per page.

Technologies

This API was developed with the following technologies:

  • NodeJS
  • Fastify
  • Typescript
  • PostgreSQL
  • TypeORM
  • Prisma

Getting Started

Pre-requisites

  • Node(LTS version)
  • NPM v9.0.0 or higher
  • PostgreSQL

You can get the latest version of NodeJS from here or you can check the version you have installed on your machine by running the following command in your terminal

  node -v

You can get the latest version of NPM from here or you can check the version you have installed on your machine by running the following command in your terminal

  npm -v

You can get the latest version of PostgreSQL from here or you can check the version you have installed on your machine by running the following command in your terminal

  psql -V

Installation

Clone the project

  git clone git@github.com:vicodevv/Blog-API.git

Go to the project directory

  cd Blog-API

Install dependencies

  npm install

Run the code

  npm run dev

Running Tests

To run tests, run the following command

  npm run test

Class Diagram

Postman Documentation

https://documenter.getpostman.com/view/17026180/2s9YC7UC7K

Live Link

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

  • DATABASE_URL=your database url

API Reference

Method Description Endpoints
GET Get all blog posts /all
GET Get a single blog post /:id
POST Create a blog post /create
PUT Update a blog post /update/:id
DELETE Delete a blog post /delete/:id

Authors

License

MIT