Skip to content

Latest commit

 

History

History
164 lines (133 loc) · 4.15 KB

README.md

File metadata and controls

164 lines (133 loc) · 4.15 KB

Prologic API

Web Api created for building applications in voluntary work in NGOs and in teaching new professionals of Technology

Nest Powered

Getting Started

Follow these steps and quickly your application will be running, remember the purpose of this project, be a volunteer and help some institution with your knowledge..

Prerequisites

  • Npm
    npm install -g typescript
  • PostgreSQL Database
    docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres

Installation

  1. Clone the repo
    git clone https://github.com/ricardopadua/prologic-api.git
  2. Install NPM packages
    npm install
  3. Configure the environment variables in the config folder /config , there are 3 configuration files, the default.json that represents the development environment, the production.json that represents the production environment and the index.ts that imports these configured environments and exports these constants to the application. Observe the example respectively:
default.json
{
    "ioc": {
        "childContainerBind": "" 
    },
    "cryptography": {
        "passwordDefault": ""
    }
}
production.json
{
    "ioc": {
        "childContainerBind": ""
    },
    "cryptography": {
        "passwordDefault": ""
    }
}
index.ts
import config from 'config';
//  IOC configuration constant
const ioc = {
    childContainerBind: config.get<string>('ioc.childContainerBind')
};
//  Cryptography configuration constant
const cryptography = {
    passwordDefault: config.get<string>('cryptography.passwordDefault')
};
const environment = {
    ioc: ioc,
    cryptography: cryptography,
}
export default environment;

docker (Optional)

  1. If you want to run the application in docker, configure the file docker-compose and after the command docker-compose up --build -d
  2. Configure the environment variables for containers in docker-compose.yml file:
docker-compose.yml
version: '3.4'
services:
  server:
    build:
      context: .
      dockerfile: ./Dockerfile
      args:
        - http_proxy
        - https_proxy
        - no_proxy
    image: prologyc/server:latest
    ports:
      - '8433:8433'
    stdin_open: true
    tty: true
  postgres-db:
    image: 'postgres:9.6.2'
    container_name: postgres
    environment:
      POSTGRES_HOST: 
      POSTGRES_PASSWORD: 
      POSTGRES_DB: 
      POSTGRES_USER: 
      PGDATA: /tmp
    ports:
      - '5432:5432'
    hostname: postgres-log
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - './docker-volumes/postgres-desenvolvimento:/var/lib/postgresql/data'

Sample configuration

See the sample gist configuration for a sample of configuration (environment variables).

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Ricardo Padua - @RicardoPdua4

Project Link: https://github.com/ricardopadua/prologic-webapi