Skip to content

DannOut/Blogs-API

Repository files navigation

Blogs API

Trybe 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:

⚙️ How to use

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

git clone [email protected]: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 <your-username> -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 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 Captura de tela de 2023-01-03 12-17-42


Developed by Daniel Outeiro, © 2022.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published