Sitemap
DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.

A Book Repository API 😄

3 min readNov 21, 2022

--

Languages used:

  1. Node.js https://nodejs.org/en/download/
  2. Sequelize (ORM) https://sequelize.org/
  3. Docker https://docs.docker.com/engine/install/ubuntu/
  4. PostgresSQL https://www.postgresql.org/download/

What will be needed to run the code:

  1. git clone https://github.com/diogoX451/Repositorios-de-Livros-Node.js
Press enter or click to view image in full size
https://github.com/diogoX451

2. Inside the project root, type in the terminal “npm install”

3. Now let’s run docker, because we won’t need to configure a database on the machine, but run on localhost and your “docker-compose.yml” is already configured

3.1 The use command “docker-compose up -d”

3.2 Check container logs docker “docker compose logs”

3.3 The database goes on http://localhost:16543 and

Get Diogo Almeida’s stories in your inbox

Join Medium for free to get updates from this writer.

User: admin@admin.com and password: admin123

Press enter or click to view image in full size
http://localhost:16543/login?next=%2F

3.4 Add server

Press enter or click to view image in full size

3.5 Enter the database name and add the server, remembering that the password is the same as the one that entered the database initially and the hostname is “apiBook”. Click on Save

4. Using the modeling already done by sequelize, let’s import it to the database, with the command “npm or yarn sequelize db:migrate”

Press enter or click to view image in full size

5. As we created a container by docker, our api is already instantiated in this container and can be accessed by “http://localhost:3000”

Press enter or click to view image in full size

6. Using insomnia or Postman we will make our requests following the following routes:

Thanks a lot for reading 🤟

This api is undergoing improvements, you can follow it on my Github. So the features it has can be useful for a simple application on the web.😄

By: Diogo Almeida

--

--

Diogo Almeida
Diogo Almeida

Written by Diogo Almeida

~Software Engineering ~> A little programmer in this world

DevOps.dev
DevOps.dev

Published in DevOps.dev

Devops.dev is a community of DevOps enthusiasts sharing insight, stories, and the latest development in the field.