https://github.com/bahdcoder/population-management-api
https://github.com/bahdcoder/population-management-api
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/bahdcoder/population-management-api
- Owner: bahdcoder
- Created: 2019-02-10T17:40:08.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-10T18:29:57.000Z (over 7 years ago)
- Last Synced: 2025-02-21T03:11:21.400Z (over 1 year ago)
- Language: JavaScript
- Size: 59.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Population Management API
### How to run project
This project is built on the adonis framework. To make development faster, install the adonis cli using the command `npm install -g @adonisjs/cli`
- Clone repository
- Install npm dependencies
- Create a file `.env` at project root, and use `.env.example` as a sample to setup your environment variables. For database, setup mysql or sqlite3. your choice.
- Be sure to generate application key using `adonis key:generate`
- Run migrations using command `adonis migration:run`
- Run seeders using command `adonis seed`
- Run application using `adonis serve --dev`
- Run application tests using `adonis test`
- To get a list of users with authentication tokens for them, make api request to `https://localhost:3333/`
#### API DOCUMENTATION / Available endpoints
- `POST /locations`: This endpoint is used to add new location data.
- Required attributes:
- `name` must be unique
- `male_count` must be an integer
- `female_count` must be an integer
- Optional attributes
- `location_id` must be a valid id of an existing location. use this to create nested locations.
- `GET /locations`: This endpoint is used to get all locations and their data.
- `PUT/PATCH /locations/:id`: This endpoint is used to update any attributes of the location. All attributes except `id` and `location_id` can be updated.
- `DELETE /locations/:id`: This endpoint is used to delete a location.
For more details on all endpoints, please refer to the tests.