Skip to content

API and a database for producing content for a blog! Developed in Node.js using the sequelize package to do a CRUD of posts.

Notifications You must be signed in to change notification settings

felipehfernandes/blog-api

Repository files navigation

Blog API!

👨‍💻 What was developed

In this project an API and a database were developed for the production of content for a blog!

The application was developed in Node.js using the sequelize package to make a CRUD of posts.

  1. Endpoints were developed that are connected to the database following REST principles;

  2. To make a post you need a user and a login, so the relationship between user and post is worked on;

  3. Categories were used for the posts, thus working the relation of posts to categories and categories to posts.


🎲 ER Diagram, Entities and Scripts

Entity-Relationship Diagram

To guide the manipulation of the tables, use the following DER:

DER


Entities format

The project uses ORM Sequelize to create and update the database.

  • A table called users, contains data with the following structure:
| id  | display_name    | email           | password | image                                                                                   |
| --- | --------------- | --------------- | -------- | --------------------------------------------------------------------------------------- |
| 1   | Brett Wiltshire | brett@email.com // tem quer ser único | 123456   | http://4.bp.blogspot.com/_YA50adQ-7vQ/S1gfR_6ufpI/AAAAAAAAAAk/1ErJGgRWZDg/S45/brett.png |
  • A table called categories, contains data with the following structure:

    id name
    18 News
  • A table called blog_posts contains data with the following structure:

    id title content user_id published updated
    21 Latest updates, August 1st The whole text for the blog post goes here in this key 14 // Chave estrangeira, referenciando o id de users 2011-08-01T19:58:00.000Z 2011-08-01T19:58:51.947Z
  • A table called PostCategories, contains a composite primary key using the two structure attributes:

    post_id category_id
    50 // Chave primária e estrangeira, referenciando o id de BlogPosts 20 // Chave primária e estrangeira, referenciando o id de Categories

    Ready-made script tips

    • Delete the database:
    "drop": "npx sequelize-cli db:drop"
    • Create the database and generate the tables:
    "prestart": "npx sequelize-cli db:create && npx sequelize-cli db:migrate"
    • Insert data / Populate the table:
    "seed": "npx sequelize-cli db:seed:all"

About

API and a database for producing content for a blog! Developed in Node.js using the sequelize package to do a CRUD of posts.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages