https://github.com/kakkoyun/scooter-spotter
A small Go web API that finds available scooters
https://github.com/kakkoyun/scooter-spotter
Last synced: about 1 month ago
JSON representation
A small Go web API that finds available scooters
- Host: GitHub
- URL: https://github.com/kakkoyun/scooter-spotter
- Owner: kakkoyun
- License: apache-2.0
- Created: 2019-04-07T10:53:48.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-09T12:18:01.000Z (about 6 years ago)
- Last Synced: 2025-01-25T16:24:27.481Z (3 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# scooter-spotter
[](https://github.com/kakkoyun/scooter-spotter/releases) [](https://github.com/kakkoyun/scooter-spotter/commits/master) [](https://cloud.drone.io/kakkoyun/scooter-spotter) [](http://godoc.org/github.com/kakkoyun/scooter-spotter) [](https://goreportcard.com/report/github.com/kakkoyun/scooter-spotter) [](https://microbadger.com/images/kakkoyun/scooter-spotter) [](https://microbadger.com/images/kakkoyun/scooter-spotter)An API service to search for available Scooters.
## How does it work
`scooter-spotter` is a small binary program that searches and finds available scooters in given time interval (default: 1 second).
It is a simple map-reduce task system which schedules `max * 2` and collects results from backing API.
If the given time-out interval is exceeded or if necessary maximum limit is reached, it returns collected results.## Examples
```console
$ curl 'localhost:4000/scooters?max=10'
[{id: 1, battery_level: 90, available_for_rent: true}]
```## Usage
### Using executable (with CLI args)
```console
$ ./scooter-spotter -hUsage of scooter-spotter:
-grace-period int
grace period to wait for connections to drain, in secods (default 5)
-port int
host port to listen (default 4000)```
### Using Docker (with Environment variables)
```bash
$ docker run --rm \
-e SCOOTER_SEARCH_API_URL=mybeautifulseachapi.com \
-e SCOOTER_SEARCH_API_TIMEOUT=10 \
kakkoyun/scooter-spotter
```## Variables
- `SCOOTER_SEARCH_API_URL`: Backend Seach API URL
- `SCOOTER_SEARCH_API_TIMEOUT`: Timeout value in seconds to execute search queries## Development
### Build Binary
Build the binary with the following commands:
```console
$ go build .
```### Build Docker
Build the docker image with the following commands:
```console
$ make docker-build
```### Release Docker
```console
$ make docker-push
```## Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/kakkoyun/scooter-spotter/tags).
## License and Copyright
This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details