/Blogs-API

Primary LanguageJavaScript

Blogs-API Project

Introduction:

Blogs API Project is a RESTFul API developed in the Back-end Module at Trybe Web Development course.
It is a posts and users management system for a blog that presents all the CRUD methods.

Applied Technologies

Methodologies:

  • Kanban
  • Scrum

Instructions

:octocat: Cloning the repository and installing node modules
  1. Clone the repository
  • git clone git@github.com:carlosaflach/Blogs-API.git;

  • Enter in the folder that was created in the cloning process:

    • cd Blogs-API;
  1. Install the dependencies
  • npm install ou npm i;
🎲 Configuring the database connection
  1. Creating the configuration file
  • Create an .env file in the project root:

    • touch .env;
  • Place the following information in the .env file and replace with your credentials:

SERVER VARS

NODE_ENV=development API_PORT=3000

DATABASE VARS

MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_DB_NAME=blogs-api MYSQL_USER=yourUser MYSQL_PASSWORD=yourPassword

SECRECT VARS

JWT_SECRET=yourSecret ```

NOTE: You will need to create a local database to use this API. In this manual, I called the database name as blogs-api, but you can call it whatever you want. It's just important that you make sure to create one database and configure it at the .env file to the API work properly.

🏃 Running the API locally
  • Run the following command in the terminal from the project root::

    • npm start;
🐳 Running via Docker

If you wanted and have the knowledge of how to use it, there is a file docker-compose in the root of the project, follow the commands create and access the containers:

  • At the root of the project run the following command:

    • docker-compose up -d;
  • To access the container terminal, run the following command:

    • docker container exec -it store_manager bash;
  • To close the container terminal, run the command:

    • exit;
  • If you are no longer using containers, run the following command:

    • docker-compose down;

📃 Documentation

🚧 Under Construction 🚧