Git Product home page Git Product logo

companies-test-task's Introduction

Requirements:

  • docker v20.0+
  • docker-compose v2.12+
  • If you're running from Windows, you should have WSL installed (it's already installed with Docker Desktop by default) to be able to run shell scripts.

How to run:

  1. Change your working directory to project root
  2. Create your own .env file. You should set your own HMAC_SECRET and DB_PASSWORD. Other params may also be changed. You may take example from .env.example.
  3. Run shell script that is located at build/build_and_up.sh without any params. Remember that your working directory must be the project root.
  4. After services started run the migration script to initialize db schema:
docker exec companies-api /app/migrate
  1. You may import Postman collection at tests/postman-collection/companies-test-task.postman_collection.json for testing.
  2. After finishing testing run shell script build/down.sh to stop and delete all containers.

Environmental variable description:

  • LISTEN_ADDR socket address that companies service will listen at. Default is :8080;
  • HMAC_SECRET is used for signing/verifying JWT tokens. Empty by default;
  • DB_HOST must point to Postgres IP address. Default: localhost;
  • DB_PORT must point to Postgres port. Default:5432;
  • DB_USER is Postgres username. Default: companies;
  • DB_PASSWORD is Postgres password. Empty by default;
  • DB_NAME is the database name. Default: companies;
  • DB_MIGRATIONS - relative path to migration scripts. Default: db_migration.

Note about authentication:

There is a tiny auth "service" at :8090 that has only one endpoint GET /login which signs new JWT token with configured HMAC_SECRET. This JWT token then passed to CRUD endpoints on companies service. There is no login/password prompt for simplicity purpose - just a new valid JWT token.

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.