Web Api created for building applications in voluntary work in NGOs and in teaching new professionals of Technology
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..
- Npm
npm install -g typescript
- PostgreSQL Database
docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres
- Clone the repo
git clone https://github.com/ricardopadua/prologic-api.git
- Install NPM packages
npm install
- Configure the environment variables in the config folder
/config
, there are 3 configuration files, thedefault.json
that represents the development environment, theproduction.json
that represents the production environment and theindex.ts
that imports these configured environments and exports these constants to the application. Observe the example respectively:
{
"ioc": {
"childContainerBind": ""
},
"cryptography": {
"passwordDefault": ""
}
}
{
"ioc": {
"childContainerBind": ""
},
"cryptography": {
"passwordDefault": ""
}
}
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;
- If you want to run the application in docker, configure the file docker-compose and after the command
docker-compose up --build -d
- Configure the environment variables for containers in
docker-compose.yml
file:
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'
See the sample gist configuration for a sample of configuration (environment variables).
See the open issues for a list of proposed features (and known issues).
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Ricardo Padua - @RicardoPdua4
Project Link: https://github.com/ricardopadua/prologic-webapi