A RESTful places API built using Laravel framework.
API »
Table of Contents
Places API is a RESTful api based on the Geonames database. You can use this API to explore the world!
To get a local copy up and running follow these simple example steps.
We recommend settings up and running the project using Docker and Docker Compose.
You will need:
- PHP 8.2
- Composer
- Node Package Manager (NPM)
- Docker
- Docker Compose
- Clone the repository
git clone https://github.com/NizarBerjawi/places-api.git
- Create an .env file
cp .env.example .env
- Install composer packages
docker compose run --rm composer install
- Install npm packages
docker compose run --rm npm install
- Generate Open API spec
docker compose run --rm artisan docs:generate
- Build assets
docker compose run --rm npm run build
- Migrate the database
docker compose run --rm artisan migrate:fresh
- Generate an application key
docker compose run --rm artisan key:generate
At this point you can already start up the application, however there won't be any data in the database.
To start the application without data, exit the interactive shell and jump to step 11
below, otherwise just keep on going through the steps below.
Please note that downloading and importing the data will download ALL the Geonames dump export files and then imports them into the database. Depending on your CPU power, This process could take up to several hours to complete.
-
Push the file download jobs to the queue
docker compose run --rm artisan geonames:download
Then process the queue:
docker compose run --rm artisan queue:work --stop-when-empty --queue=download-data,download-places,download-flags,download-names
-
When all the files have been downloaded, push the file import jobs to the queue
docker compose run --rm artisan geonames:import
Then process the queue:
docker compose run --rm artisan queue:work --stop-when-empty --queue=import-data,import-places,import-names
- Start the application server
docker compose up --build nginx
- Open the application in a browser
http://localhost:8080
For a full details, please refer to the Documentation.
If you like my work and find that this project helps, please support!
Distributed under the MIT License. See LICENSE.txt for more information.
If you find any issues, please contact the developer:
Nizar El Berjawi - [email protected]