Giter Site home page Giter Site logo

sample-api's Introduction

Sample API

This is a sample api.

Technology Used

Setup

Environment variables

The following environment variables are expected:

  • ORIGINS: comma separated list of allowed origins.
  • POSTGRES_SERVER: URL of db server
  • POSTGRES_USER
  • POSTGRES_PASSWORD
  • POSTGRES_DB: postgres DB name

DB adaptor

The psycopg2 adaptor is used. Note the installation requirements for the psycopg2 package. The sample-api dependencies use the psycopg2 package and not the psycopg2-binary package.

Local Development

Running locally

  • Run docker compose up command from root directory to start the entire stack. The following will be started:
    • Postgres server
    • Flyway - it setups the postgres tables and inserts some dev data.
    • sample-api server
  • Environment variables are defined in the docker-compose.yml
  • The sample-api folder is volume mounted, so any changes to the code will be reflected in the container
  • The API's documentation is available at http://localhost:3003/docs.

Unit tests

  • Run docker compose --profile test up command to run the unit tests from the root directory. This will run the above services as well as the unit tests.
  • The folder is volume mounted, so any changes to the code will be reflected in the container and run the unit tests again.

The API

This is a simple API. It is not production ready.

The API is based on the table schema defined in V1.0.0__init.sql file. Note the foreign key constraint if you want to try the endpoints out.

The http://localhost:3003/docs page lists the available endpoints.

sample-api's People

Contributors

monicag avatar

Watchers

 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.