Skip to content

This is an API with CRUD (create, read, update and delete) that manages a SQL blogs database.

Notifications You must be signed in to change notification settings

andreallherrera/project-blogs-api

Repository files navigation

BLOGS API

Description

This project was about creating an REST API with CRUD using Sequelize and MSC architecture. The project uses a relational database MySQL and it has unit tests in Mocha, Chai and Sinon. database structure

Tools

  • NodeJs w/ ExpressJs
  • MySQL
  • Sequelize
  • Joi
  • JWT
  • Mocha/ Chai / Sinon

Install

Clone this project and install all the dependencies

  npm install

Create a .env file like this:

  MYSQL_USER=root
  MYSQL_PASSWORD=aPassword
  HOSTNAME=localhost
  PORT=3000
  JWT_SECRET=anySecret

Running the following command you will create the database tables and seed them:

  npm run prestart
  npm run seed

For debugging run:

  npm run debug

Now you can use Postman, Thunder Client or Insomnia for making the requests to the endpoints.

You can also give a look to the Sequelize Setup Cheatsheet made by Rocket Academy.

🟢 Endpoints

User

  • POST /user
  • GET /user
  • GET /user/:id
  • DELETE /user/:id

Login

  • POST /login

Category

  • POST /categories
  • GET /categories

Blog post

  • POST /post
  • GET /post
  • GET /post/search
  • GET /post/:id
  • PUT /post/:id
  • DELETE /post/:id

About

This is an API with CRUD (create, read, update and delete) that manages a SQL blogs database.

Topics

Resources

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •