Giter Club home page Giter Club logo

galway-bus-openapi's Introduction

Galway-Bus-OpenAPI

The Galway Bus OpenAPI is a RESTful API providing travel information on Bus Eireann services in Ireland, with a focus on Galway City. The project was built with the desire to make it easier to access information about bus services in the city.

API follows a Design-First approach, firstly building how the route will look, how its return info will look, the format of parameters, etc until the entire design of the API is fleshed out. This approach lowers the barrier to entry for API development and means Business Analysts, QA's and Project Managers can have both more involvement in the development and more insight into what the end result will look like.

Update 04/01/19:

This project was started last year intending to give an OpenAPI for the Bus service with support for some of the newer technology such as Docker. Since then, the original developer @appsandwich has updated his repo with new features including the new API endpoints.

With this in mind, you should check out his repo for a nice working project with more features.

Installation

Prerequisites

In order to build and run the project locally you will need the following installed :

  1. NodeJS >= 8.0.0
  2. Yarn

Quickstart

Development can be performed locally as follows:


yarn

yarn run dev

Contributors

All Contributors This project follows the all-contributors specification. Contributions of any kind are welcome!

A list of contributors to this project (emoji key):


Ryan Gordon

๐Ÿ“ ๐Ÿ› ๐Ÿ’ป ๐ŸŽจ ๐Ÿ“– ๐Ÿ‘€ โš ๏ธ ๐Ÿ”ง โœ…

Vinny Coyne

๐ŸŽจ ๐Ÿ’ก ๐Ÿค”

Acknowledgements

The idea for this project came from another repo I found on Github. galwaybus, by @appsandwich is a project with aims of providing a simple API to access Galway bus info, returning it in a valid JSON format.
This project was born from that project and borrows ideas and practices from it. The aim of this project was to develop a Typescript implementation of the Galway Bus API, adopting the OpenAPI specification and using modern practices like async/await.

If you are interested in seeing a Javascript implementation, take a look at galwaybus, by @appsandwich

galway-bus-openapi's People

Contributors

ryan-gordon avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

galway-bus-openapi's Issues

Dockerfile

API should have a Docker file so that deployment is simplified and reduced to 1 or 2 bash commands.

Route Testing

Routes should be tested. This can be done in a few ways and this issue may serve as a parent issue with new issues created for each type of testing.

Adopt Gitflow

In order to accommodate multiple contributors and ensure a stable build remains on Master branch, Gitflow would be a good adoption.

docker-compose

Docker-compose is a very handy tool for defining and running multi container applications.

It would be good to try and utilise this in the project; but ideally we would want to find a use for it to make it worth the time. One thought is we could make use of some message queues using either RabbitMQ or ActiveMQ.
Another possible use case would be to set up a NGINX container and host 2 or more API containers for load-balancing.

Open to ideas on this.

allStops endpoint

The allStops endpoint should return all of the stops in the Galway area.

This will submit a request to RTPi and attempt to get all the stops in a X metre radius from Galway city centre.

Should be rate-limited in the future so that it isn't abused.

Nearby Bus Stops Inaccurate locations

Currently the nearby route takes in the parameters and queries the API but doesn't find stops close to the co-ordinates. For example, taking the point of GMIT the API returned stops in Dublin.

A problem with the distance calculation possibly.

Deployment

The API should be served on some Platform.

Good candidates are :
Heroku, Google Cloud, Azure, AWS in no order

Nearby bus stops

This endpoint will take in 2 parameters; longitude and latitude which represent the co ordinate location we are querying for.

The endpoint should then take these co ordinates and find the nearest X stops to that location.

Depends on the stops endpoint as it will more than likely use it for information

The old RTPI endpoint no longer works

Related to appsandwich/galwaybus#1

The old RTPI endpoint this repo depended on no longer works and will need to be changed.
This might require refactoring the implementation a bit.

The good news is Vinny, the original developer for the Galway bus repo, has updated his repo with the new endpoints.

@appsandwich ,do you want to try and merge our projects into an Github Org or something? I think the idea can be expanded even further.
You got a working project is JS
I had an almost working project in TS with OpenAPI documentation.

Rate Limiting

API's commonly use rate limiting to deter malicious requests aiming to slow down the system for others and also ensure clients don't just spam the routes.

The main routes which benefit most from these are the routes related to Stop resources as these are the most complex.

Create strict typing

Seen as how we are using Typescript for this API we should be leveraging its type casting. This means that our objects are what we expect every time. With the absence of these types the code inherits some of the same shortcomings as raw JavaScript.

In the event that a type does not exist or contain all the data required for a variable we can create our own type (combine 2 or more types), and we can also use the object spread operator to combine objects together if necessary.

Setup server logging

Server logging is very useful when trying to debug a potential error.

Some form of server logging should be set up rather than just using console.log everywhere.
A good candidate for this would be : Bunyan

Implement a Caching system

Currently some of the routes have a very high cost both in terms of how long it takes to get information and how long it takes to format it.

Stops for Galway should be cached in some way to speed up queries.
This wont affect the routes which return times for a stop; in fact it should speed them up.

This may serve as a parent issue as the task is broken down into smaller ones.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.