All Projects → lmammino → realtime-transport-dashboards

lmammino / realtime-transport-dashboards

Licence: MIT license
Serverless APIs for AWS to build and display public transports real time data (Serverless application example)

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to realtime-transport-dashboards

LuasataGlance
Android Wear and mobile app providing real-time tram stop information for Dublin's Luas light rail service.
Stars: ✭ 21 (-8.7%)
Mutual labels:  ireland, public-transport
CloudFrontier
Monitor the internet attack surface of various public cloud environments. Currently supports AWS, GCP, Azure, DigitalOcean and Oracle Cloud.
Stars: ✭ 102 (+343.48%)
Mutual labels:  api-gateway
Sample Zuul Filters
Samples of custom Zuul 1 filters for use in Spring Cloud Netflix
Stars: ✭ 201 (+773.91%)
Mutual labels:  api-gateway
Krakend Ce
KrakenD Community Edition. Make your binary of KrakenD API Gateway
Stars: ✭ 245 (+965.22%)
Mutual labels:  api-gateway
Express Gateway
A microservices API Gateway built on top of Express.js
Stars: ✭ 2,583 (+11130.43%)
Mutual labels:  api-gateway
transport-apis
machine-readable list of transport API endpoints
Stars: ✭ 32 (+39.13%)
Mutual labels:  public-transport
Moleculer Web
🌍 Official API Gateway service for Moleculer framework
Stars: ✭ 198 (+760.87%)
Mutual labels:  api-gateway
comboios
Comboios de Portugal (CP, Portugese Railways) API client.
Stars: ✭ 32 (+39.13%)
Mutual labels:  public-transport
yappa
Serverless deploy of python web-apps @yandexcloud
Stars: ✭ 57 (+147.83%)
Mutual labels:  api-gateway
Aspnetcore.proxy
ASP.NET Core Proxies made easy.
Stars: ✭ 234 (+917.39%)
Mutual labels:  api-gateway
Apicast
3scale API Gateway
Stars: ✭ 225 (+878.26%)
Mutual labels:  api-gateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+839.13%)
Mutual labels:  api-gateway
kong-plugin-url-rewrite
Kong API Gateway plugin for url-rewrite purposes
Stars: ✭ 43 (+86.96%)
Mutual labels:  api-gateway
Yoyo
A dead simple comment engine built on top of AWS lambda and React, alternative comment service to Disqus.
Stars: ✭ 210 (+813.04%)
Mutual labels:  api-gateway
zeppelin-gateway
Object Gateway Provide Applications with a RESTful Gateway to zeppelin
Stars: ✭ 24 (+4.35%)
Mutual labels:  api-gateway
Aws Mobile React Native Starter
AWS Mobile React Native Starter App https://aws.amazon.com/mobile
Stars: ✭ 2,247 (+9669.57%)
Mutual labels:  api-gateway
Dgate
an API Gateway based on Vert.x
Stars: ✭ 222 (+865.22%)
Mutual labels:  api-gateway
gateway
A high-performance API Gateway with middlewares, supporting HTTP and gRPC protocols.
Stars: ✭ 520 (+2160.87%)
Mutual labels:  api-gateway
api-gateway
Node.js API gateway that works as single entry point for all clients in a MicroService architecture pattern.
Stars: ✭ 26 (+13.04%)
Mutual labels:  api-gateway
serverless-go
Serverless Golang Function to Discover Movies 🎥
Stars: ✭ 37 (+60.87%)
Mutual labels:  api-gateway

realtime-transport-dashboards

Build Status JavaScript Style Guide

Serverless APIs for AWS to build and display Irish public transports real time data.

This is a sample serverless application that can be used for workshops or other educational purposes.

The application allows you to create dashboards. Every dashboard can contain 0 or more widgets. A widget can display real time information about a specific Dublin Bus stop, a LUAS stop or a Irish Rail station.

An example of a dashboard in terms of data structure:

Example of dashboard

The application offers APIs to create, edit and visualize dashboards and widgets.

Getting started

Before starting make sure you have the AWS CLI installed and properly configured.

You will also need Node.js version 8+.

Now clone this repository in your local workspace and run the following command to install the necessary dependencies:

npm install

Now you can deploy the service to your local AWS account with the following command:

npm run deploy

If everything went fine you should see the URL for the deployed API endpoints.

APIs

Once you deploy the functions you will be able to access the following APIS:

To run the examples, export your API endpoint prefix as PREFIX, for instance:

PREFIX="https://<api_gate_way_id>.execute-api.eu-west-1.amazonaws.com/prod"

Make sure to replace <api_gate_way_id> with you actual deployment id.

⚡️ createDashboard

Creates a new dashboard.

Endpoint

POST `/dashboard`

Payload

{
  "name": "<string>"
}

Example

curl -XPOST -i -H "Content-Type: application/json" -d '{"name":"my-dashboard"}' "${PREFIX}/dashboard"

Example Output:

HTTP/2 200
content-type: application/json

{
  "id":"d733b0b2-f429-4bdf-82ab-c9fc3b3190d7",
  "name":"my-dashboard",
  "createdAt":"2019-09-29T09:06:17.698Z",
  "updatedAt":"2019-09-29T09:06:17.698Z",
  "widgets":[]
}

⚡️ updateDashboard

Updates an existing dashboard. It basically allows you to change a dashboard name.

Endpoint

POST `/dashboard/{dashboard_id}`

Payload

{
  "name": "<string>"
}

Example

curl -XPOST -i -H "Content-Type: application/json" -d '{"name":"new-name"}' "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7"

Example Output:

HTTP/2 200
content-type: application/json
content-length: 154

{
  "createdAt":"2019-09-29T13:14:47.299Z",
  "widgets":[],
  "id":"d733b0b2-f429-4bdf-82ab-c9fc3b3190d7",
  "name":"new-name",
  "updatedAt":"2019-09-29T13:15:37.134Z"
}

⚡️ deleteDashboard

Deletes an existing dashboard

Endpoint

DELETE `/dashboard/{dashboard_id}`

Example

curl -XDELETE -i "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7"

Example Output:

HTTP/2 200
content-type: application/json
content-length: 0


⚡️ getDashboard

Get data for a dashboard and real time information for every widget

Endpoint

GET `/dashboard/{dashboard_id}`

Example

curl -XGET -i "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7"

Example Output:

HTTP/2 200
content-type: application/json
content-length: 401

{
  "createdAt":"2019-09-28T14:12:03.196Z",
  "widgets":
  [
    {
      "config":{
        "type":"luas",
        "parameters":{
          "code":"STI",
          "direction":"Inbound"
        }
      },
      "id":"6cacba61-c862-4f1e-9ca4-e5dc8f67258e",
      "name":"Stillorgan LUAS inbound",
      "realtimeInfo":
      [
        {
          "direction":"Inbound",
          "destination":"Broombridge",
          "arrivingInMinutes":9,
          "expectedArrivalTime":"2019-09-29T11:59:39.000+01:00"
        }
      ]
    }
  ],
  "id":"d733b0b2-f429-4bdf-82ab-c9fc3b3190d7",
  "name":"new-name",
  "updatedAt":"2019-09-28T16:43:05.570Z"
}

⚡️ addWidget

Adds a new widget to an existing dashboard

Endpoint

POST `/dashboard/{dashboard_id}/widget`

Payload

{
  "name": "<string>",
  "config": {
    "type": "irishRail | dublinBus | luas",
    "parameters": {
      "code": "<string>",
      "direction": "<string> (optional - only for irishRail and luas)"
    }
  }
}

Example

Adds a widget to monitor the Luas Dominick stop Inbound:

curl -XPOST -i -H "Content-Type: application/json" -d '{"name": "Luas Dominick Inbound", "config": {"type": "luas", "parameters": {"code": "DOM", "direction": "Inbound"}}}' "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7/widget"

Example Output:

HTTP/2 200
content-type: application/json
content-length: 151

{
  "name":"Luas Dominick Inbound",
  "config":{
    "type":"luas",
    "parameters":{
      "code":"DOM",
      "direction":"Inbound"
    }
  },
  "id":"59b8a71b-d8c6-4569-9ec8-69c5ff0c7521"
}

⚡️ updateWidget

Updates an existing widget

Endpoint

POST `/dashboard/{dashboard_id}/widget/{widget_id}`

Payload

{
  "name": "<string>",
  "config": {
    "type": "irishRail | dublinBus | luas",
    "parameters": {
      "code": "<string>",
      "direction": "<string> (optional - only for irishRail and luas)"
    }
  }
}

Example

Changes the previous widget direction from Outbound to Inbound:

curl -XPOST -i -H "Content-Type: application/json" -d '{"name": "Luas Dominick Inbound", "config": {"type": "luas", "parameters": {"code": "DOM", "direction": "Outbound"}}}' "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7/widget/59b8a71b-d8c6-4569-9ec8-69c5ff0c7521"

Example Output:

HTTP/2 200
content-type: application/json
content-length: 151

{
  "createdAt":"2019-09-29T13:14:47.299Z",
  "widgets":[
    {
      "name":"Luas Dominick Inbound",
      "config":{
        "type":"luas",
        "parameters":{
          "code":"DOM",
          "direction":"Outbound"
        }
      },
      "id":"59b8a71b-d8c6-4569-9ec8-69c5ff0c7521"
    }
  ],
  "id":"d733b0b2-f429-4bdf-82ab-c9fc3b3190d7",
  "name":"new-name",
  "updatedAt":"2019-09-29T13:39:10.719Z"
}

⚡️ deleteWidget

Deletes an existing widget from a dashboard

Endpoint

DELETE `/dashboard/{dashboard_id}/widget/{widget_id}`

Example

curl -XDELETE -i "${PREFIX}/dashboard/d733b0b2-f429-4bdf-82ab-c9fc3b3190d7/widget/59b8a71b-d8c6-4569-9ec8-69c5ff0c7521"

Example Output:

HTTP/2 200
content-type: text/plain
content-length: 0


AWS Cleanup

If you want to remove all the resources created by this project from your AWS account you can simply run:

npm run cleanup

Utilities

This repository contains a number of utility scripts to get information for the supported realtime services:

  • Get all Dublin Bus stops: node utils/allBusStops.js
  • Get all Irish Rail stations: node utils/allRailStations.js
  • Get all Luas stops: node utils/allLuasStops.js

Contributing

Everyone is very welcome to contribute to this project. You can contribute just by submitting bugs or suggesting improvements by opening an issue on GitHub or PRs.

License

Licensed under MIT License. © Luciano Mammino.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].