56 lines
1.1 KiB
Markdown
56 lines
1.1 KiB
Markdown
# National Parks Demo App
|
||
|
||
## Prerequisites
|
||
|
||
- Ruby 3.4.7
|
||
- Bundler
|
||
- An API key from the [national parks service](https://www.nps.gov/subjects/developer/get-started.htm)
|
||
|
||
### Under the hood
|
||
|
||
- Ruby 3.4.7
|
||
- Rails 8.0.3
|
||
- SQLite
|
||
|
||
## Getting started
|
||
|
||
1. `bundle install`
|
||
- You know this one; install dependencies
|
||
2. Set `NPS_API_KEY` using your tool of choice
|
||
3. `bin/rails db:prepare`
|
||
- This will create and seed your database
|
||
- hint: `tail -f log/development.log` to see what's going on
|
||
4. `bin/rails server`
|
||
- Congrats you're ready to receive requests
|
||
```
|
||
❯ curl 'localhost:3000/api/v1/stats'
|
||
{
|
||
"park_count": 474,
|
||
"alert_count": 708,
|
||
"state_with_most_parks": {
|
||
"state": "WY",
|
||
"park_count": 10
|
||
},
|
||
"park_with_most_alerts": {
|
||
"park_code": "zion",
|
||
"alert_count": 6
|
||
}
|
||
}
|
||
```
|
||
|
||
## Testing
|
||
|
||
```
|
||
bin/rspec
|
||
```
|
||
|
||
## Notes
|
||
|
||
- What additional cols to add to parks model?
|
||
- Order results on index actions
|
||
- Enum on category for alerts
|
||
- index states for efficient search?
|
||
- full text search in sqlite?
|
||
- normalize state on a separate table?
|
||
- With postgres I would use a states:array col and gin index
|