Skip to content

josego85/api-geo-paraguay

Repository files navigation

API GEO Paraguay

Technologies

  • NodeJS v20.18.1 LTS
  • Express 5.0.1 for the API
  • NPM 10.8.2
  • MySQL 8.0.xx
  • Client Redis 4.7.0 (Redis 7.4.x)
  • Client Mongoose 8.9.3 (MongoDB Server 7.0)
  • Swagger for documentation
  • Docker version 27.4.0

Docker dev

npm i
docker compose -f docker-compose.dev.yml up --build -d
docker compose logs -f

Database in MySQL 8.0

Import Database in docker container

tar xzvf database/paraguay.sql.tar.gz
docker cp paraguay.sql database-api-geo-paraguay:/paraguay.sql
docker exec -it database-api-geo-paraguay sh
mysql -u root -p paraguay < paraguay.sql
exit

Config

cp .env.example .env

Change variables in .env

APP_PORT=5000
URL_DOMAIN="https://api-geo.proyectosbeta.net"

# DataBase MySQL
DB_HOST=database
DB_PORT=3306
DB_NAME=paraguay
DB_USER=api-geo
DB_PASSWORD=123456
DB_ROOT_PASSWORD=password
SRID=4326
SRID_TRANSFORM=3857

# MongoDB
MONGO_URI=mongodb://mongodb:27017

REDIS_HOST=cache
REDIS_PORT=6379
REDIS_PASSWORD=eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81

Install

npm install

Run app

npm start

Tools dev

Prettier

Prettier check

Check if the formatting matches this Prettier’s rules by using:

npm run format:check

Prettier format

Force the formatting by using this command:

npm run format:write

Lint

Lint check

Lint your code with:

npm run lint:check

Lint fix

Auto-fixing errors with this command:

npm run lint:fix

Docs

Access

QA

Sonarqube

Install

With docker
docker pull sonarqube
docker run -d --name sonarqube -p 9000:9000 -p 9092:9092 sonarqube
Web access
http://localhost:9000
Credencials
  • User: admin
  • Password: admin

Use

docker pull newtmitch/sonar-scanner
GNU-Linux/MacOS

Execute

docker run -ti -v /home/proyectosbeta/repositoriosGit/api-geo-paraguay:/usr/src --link sonarqube newtmitch/sonar-scanner
Microsoft Windows

Execute

docker run -ti -v C:\Users\proyectosbeta\repositoriosGit\api-paraguayos:/usr/src --link sonarqube newtmitch/sonar-scanner

Production

Build

npm run build

Docker prod

docker compose -f docker-compose.prod.yml up --build -d
docker compose logs -f

Config Nginx

server {
    server_name api-geo.proyectosbeta.net www.api-geo.proyectosbeta.net;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }

    listen 443 ssl http2; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/api-geo.proyectosbeta.net/fullchain.pem; # >
    ssl_certificate_key /etc/letsencrypt/live/api-geo.proyectosbeta.net/privkey.pem; >
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
    if ($host = www.api-geo.proyectosbeta.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = api-geo.proyectosbeta.net) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    listen 80;
    server_name api-geo.proyectosbeta.net www.api-geo.proyectosbeta.net;
    return 404; # managed by Certbot
}

Use API

About

API GEO - Paraguay

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •