An open API service indexing awesome lists of open source software.

https://github.com/larissaperinoto/blogs-api

The Blogs API is an APIRest and database for managing the production of blog content.iamento da produção de conteúdo de um blog.
https://github.com/larissaperinoto/blogs-api

express javascript joi jwt mysql nodejs sequelize sql swagger

Last synced: about 2 months ago
JSON representation

The Blogs API is an APIRest and database for managing the production of blog content.iamento da produção de conteúdo de um blog.

Awesome Lists containing this project

README

          

# Blogs API

[Trybe](https://www.betrybe.com/) is a technology school focused on training Web Developers and the Blogs API project was proposed as an activity to improve studies on back-end development.

## Description

The application is an API and a database with the content of a blog. It must allow creating, reading, updating and removing blog information from the database. It also performs authentication to grant permissions to users.

## Technologies and Tools


mysql
nodejs
docker
express
sequelize
Swagger


In the elaboration of the RESTful API, the **Model-Service-Controller(MSC)** architecture was used.The other technologies and tools were:

- [Node.JS](https://nodejs.org/en/)
- [Express](https://expressjs.com/pt-br/)
- [MySQL](https://www.mysql.com/)
- [Docker](https://www.docker.com/)
- [Sequelize](https://sequelize.org/)
- [Swagger](https://swagger.io/)

## ⚙️ How to use

To run the application start with the repositorie clone using the command bellow.

git clone git@github.com:larissaperinoto/blogs-api.git

Navigate to the project root

cd blogs-api/

Running locally

Obs: To run the application this way you must have [Node](https://nodejs.org/en/) installed on your machine.



In the root of the project run the command below to install the dependencies.

npm install

Login to the database using your credentials.

mysql -u -p

Run the commands to create the **BlogsApi** database

npm prestart

Start the application with nodemon using the command bellow.

npm debug

Running with Docker


Obs: To run the application this way you must have [Docker](https://www.docker.com/) installed on your machine.



In the root of the project, upload the blogs_api and blogs_api_db containers using docker-compose.

docker-compose up -d

Open the blogs_api container terminal.

docker exec -it blogs_api bash

Once in the container terminal, run the command below to install the dependencies.

npm install

To connect with database, open the blogs_api_db container terminal.

docker exec -it blogs_api_db bash

Login to the database using the credentials described in the docker-compose.yaml.

mysql -r root -p

To create the database, run the command bellow in the blogs_api container terminal.

npm prestart

To start the server with nodemon use the command bellow in the terminal of the blogs_api container.


npm run debug

## Routes

You can check all routes by accessing the /docs endpoint in your browser when running the application.

Routes preview

![Captura de tela de 2023-01-03 12-17-30](https://user-images.githubusercontent.com/98956659/210414272-be24136f-e2e9-4b72-8c83-f1c98ba4bc84.png)
![Captura de tela de 2023-01-03 12-17-42](https://user-images.githubusercontent.com/98956659/210414520-2b59fb45-9162-4164-81c0-44f2369ea48f.png)


---

Developed by [Larissa Perinoto](www.linkedin.com/in/larissaperinoto), © 2022.