Giter VIP home page Giter VIP logo

querido-diario-api's Introduction

querido-diario-api

Welcome to the Querido Diário API project! The goal of this repository is keep the source code used to build the API used to make available the gazettes crawled by the Querido Diário project.

Requisites

The whole project is build and run inside containers and is supported only in Linux environments (for now). As we run everything inside containers you just need to install podman to run locally in your machine. If you are not familiarize with podman, you can think it as a lightweight docker/docker-compose. It exists in almost all Linux distributions packages repositories.

Please, check podman documentation to see how to installed it in your environments. If you face some difficulties with podman, let us know!

Build

In order to be able to run and test your changes in the project, first, you need to build the container image used during development. For that you can use the following command:

make build

After that you will have a container image which can be use to run the API locally during development.

Running

To run the API locally in your machine, you can run the following command:

make run

This command will start all containers necessary to run the API. In other words, it starts the database and the API container. If everything goes fine, you should be able to query the API at localhost:8080/gazettes/<City IBGE Code>

NOTE: When you want to restart the API, just quit the API process and execute make rerun again. You do not need to restart the database.

You can all check the interactive documentation at localhost:8080/docs. Using the docs page, you can all send request to the API. But to see it working you need to insert data into the database. There is another make target, make apisql, which open the psql and connect to the database. Thus, you can insert data using some INSERT INTO ... statements and test the API. ;)

Tests

The project uses TDD during development. This means that there are no changes without tests. We should always seek 100% source code coverage. Another way to think about tests is the following:

"Write the test which forces you to write the code which you already know that you wanna write." By Robert C. Martin (a.k.a. Uncle Bob)

To run the tests you can do the following:

make test

NOTE: You do not need to restart the test database all the times you want to run the tests. Once the database is running, you need to run the make retest again.

You should do that just the first time you run the tests. After that, you can just run make retest. Of course, if you remove the database with make destroydatabse or reboot the machine, you need to start the database again.

If you can to see the code coverage:

make coverage

querido-diario-api's People

Contributors

jvanz avatar cuducos avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.