Skip to content

Unofficial API service, which returns information on Italian areas, regions, provinces and cities. (Source of data: ISTAT - Automatic database update)

License

Notifications You must be signed in to change notification settings

AntoninoBonanno/api-comuni-italiani

Repository files navigation

API Comuni italiani

Test Test

GitHub release Docker Image Size(latest by date) Docker stars Docker pulls

Unofficial API service, which returns information on Italian areas, regions, provinces and cities.

Service realized with Node.js server based on the Express framework and on the MySQL database.

Features

Startup instructions

From Docker (production)

Starting an "API Comuni italiani" instance is simple:

docker run -p 8000:8000 -e DATABASE_URL="mysql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}" --name api-comuni-italiani -d antoninobonanno/api-comuni-italiani:latest

Example: DATABASE_URL=mysql://root:@host.docker.internal:3306/comuni-italiani

NOTE: use host.docker.internal instead of localhost as DB_HOST if you have a local database (not in a docker container)

use docker-compose

You can see the example present in docker/docker-compose.yml and run the command:

docker-compose -f docker/docker-compose.yml -p api-comuni-italiani up -d

Environment Variables

Parameter Type Description
DATABASE_URL connection string Required. The database connection string: mysql://${DB_USERNAME}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE}
APP_NAME string Optional. The name of app: default API Comuni Italiani
APP_ENV development, production Optional. The environment mode: default production
APP_PORT integer Optional. The local (internal) port where the server is exposed: default 8000
ISTAT_SCAN_MONTHLY_PERIOD integer Optional. How many months you want to scan on the ISTAT site, started every first day of month at 10:00: default 5

From Clone (development)

  1. Clone the repository
  2. Copy and rename .env.example file to .env and edit settings
  3. Run npm install command to install dependencies
  4. Run npx prisma migrate dev command to initialize the database or npx prisma generate command if the database already exists
  5. Run npm start or npm run dev command to run local server (it restarts each time the code is changed)

Support me

ko-fi

Getting Involved

Want to help out? Found a bug? Missing a feature? Post an issue on our issue tracker.

I welcome contributions no matter how small or big!

About

Unofficial API service, which returns information on Italian areas, regions, provinces and cities. (Source of data: ISTAT - Automatic database update)

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published