Coder Social home page Coder Social logo

broker-api's Introduction

broker-api


API endpoints

This API's uses the OpenApi 3.0 standard for it's documentation. You can access it through a Redocs's page or, if you prefer, directly through it's yaml file.

API Install Guide

This project is meant to run using python 3.8 in an Unix-like system , other versions and OSs may not work.

All dependencies are listed on requirements.txt file. Its strongly recommended to run service in a virtual environment.

Clone project

$ git clone [email protected]:hbontempo-br/registration-validator-api.git

Setup a Virtual Environmnet

For linux/Debian distros:

$ sudo apt-get python3-venv
$ python3 -m venv .venv
$ source .venv/bin/activate

Install dependencies

From inside the project's folder:

$ pip3 install -r requirements.txt

Environment Variables

This project requires this environment variables:

Variable Definition Example Default
GUNICORN_WORKERS Number of gunicorn workers that you want 2 1
GUNICORN_WORKER_TIMEOUT Configured timeout (in seconds) 60 -
COMMIT The commit of this you running application (for better debbuging) ca82a6dff817ec66f44342007202690a93763949 None
DB_USER Application's MySQL user broker_api_user -
DB_PASSWORD Application's MySQL password broker_api_password -
DB_ADDRESS Application's MySQL address 172.0.0.1 -
DB_PORT Application's MySQL port 3306 3306
DB_DATABASE Application's MySQL schema name broker broker

Running the API locally

For local run you must set the environment variables manually or with some tool (pycharm has a nice plugin) and run this simple command:

$ .venv/bin/gunicorn -b "0.0.0.0:3000" -w 1 -t 3000 --reload app

If http://localhost:3000 is returning the api name and current version, everything is running fine.

Contributing

This project has a strict formatting validation, but it's super easy to adhere to. Just use the automatic pre-commit.

Install the pre commit:

From inside the project's folder:

Make sure the dependencies refereed on requirements-dev.txt are installed:

$ pip3 install -r requirements-dev.txt

Install the pre-commit:

$ pre-commit install

Using it:

Just make a commit! On every commit now on all the super strict formatting is taken care of automagically.

If you want to run the validation without a commit just run:

$ pre-commit run --all-files

Deploying API

Under construction

Tests

From inside the project's folder:

Make sure the dependencies refereed on requirements-dev.txt are installed:

$ pip3 install -r requirements-dev.txt

Run pytest:

$ pytest test --validate-envvars




broker-api's People

Contributors

hbontempo-br avatar

Watchers

James Cloos avatar  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.