Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ioTransit/simple-transit-api
A simple transit api written in Go
https://github.com/ioTransit/simple-transit-api
Last synced: about 1 month ago
JSON representation
A simple transit api written in Go
- Host: GitHub
- URL: https://github.com/ioTransit/simple-transit-api
- Owner: ioTransit
- License: mit
- Created: 2024-05-07T14:29:55.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-05-21T00:36:14.000Z (7 months ago)
- Last Synced: 2024-08-02T15:04:48.864Z (4 months ago)
- Language: JavaScript
- Size: 25.4 MB
- Stars: 6
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-transit - Simple Transit Api - A simple way to get started with a GTFS api in Golang. (Uncategorized / Uncategorized)
README
# Simple Transit API
A simple transit api written in Go with [gtfsparser](https://www.github.com/geops) and [Echo](https://echo.labstack.com/)## Quickstart
There are 2 agencies already setup out of the box that you can take a look at in the providers folder. Each agency will need to be setup with the unique id, name and the gtfs url.```golang
package providersimport "go-gtfs-server/app/model"
var StLouisConfig = model.AgencyConfig{
Id: "stlouis",
Name: "Saint Louis Metro",
Url: "https://www.metrostlouis.org/Transit/google_transit.zip",
}
```
### On Start
When the server is first started it will load all of the gtfs files that are in the listed in the `providers/all.go` file. Once those are loaded they are stored with their id's as unique identifiers in memory and accessible via the rest api.### On Update
In order to keep your data up to date you will need to set the `UPDATE_INTERVAL` with a [cron string](https://crontab.guru/). Once you have that setup this will allow for your gtfs to be updated on a regular interval.### Stops
- `/stops/:agencyId/` - Returns all of the stops by agency id
- `/stops/:agencyId/?stop_name=:`- Returns all of the stops by agency id that start with the query
- `/stops/:agencyId/:stopId/` - The stop from the agency with that stop_id### Routes
- `/routes/:agencyId/` - Returns all of the routes by agency id
- `/routes/:agencyId/?route_long_name=:`- Returns all of the routes by agency id that start with the query
- `/routes/:agencyId/:routeId/` - The route from the agency with that route_id### Trips
- `/trips/:agencyId/:tripId/` - Returns all of the trips by agency id
- `/trips/:agencyId/route/:routeId/` - The trips from the agency with that trip_id