Giter Club home page Giter Club logo

torontobeachapi's Introduction

Toronto Beach

 

The easiest way to access The City of Toronto's Open Data beach data API in Node.js.

 

Getting Started

Installation

  Super easy, first run this:

npm install torontobeach

Then to use:

import torontobeach from 'torontobeach';

That's it!

Now start using it with the functions and documentation below.

 

Usage

 

We are fetching data here, so we're returning promises.

    Using promises:

torontobeach.getAllBeachesLatest()
    .then(response => {
	   doCoolStuffWithData(response);
    });

Using Async/Await

const beachData = await torontobeach.getAllBeachesLatest();

  A sample response of a single data point.:

{
	beachID: 4,
	name: 'Gibraltar Point Beach',
	map: '43.612487,-79.382173',
	sampleDate: '2019-09-02',
	publishDate: '2019-09-04',
	eColiCount: 11,
	beachAdvisory: "E.coli levels are within the City of Toronto's established beach water quality standard of 100 E.coli per 100ml of water.",
	beachState: 'Safe'
}

 

Quick reference for the beach IDs:

Marie Curtis Park East Beach: 1
Sunnyside Beach: 2
Hanlan's Point Beach: 3
Gibraltar Point Beach: 4
Centre Island Beach: 5
Ward's Island Beach: 6
Cherry Beach: 7
Woodbine Beaches: 8
Kew Balmy Beach: 9
Bluffer's Beach Park: 10
Rouge Beach: 11

  All good? Awesome. Onto the good stuff.  

Methods

Latest reading for all beaches

getAllBeachesLatest();

 

All time data for all beaches

getAllBeachesAllTime();

 

All beaches between two dates.

getAllBeachesForRange('YYYY-MM-DD', 'YYYY-MM-DD');

 

Specific beach between two dates.

getSpecificBeachForRange(beachID, 'YYYY-MM-DD', 'YYYY-MM-DD');

 

All time data for specific beach

getSpecificBeachAllTime(beachID);

     

Awesome!

If you are interested in learning more, or about contributing, check out the repository at: https://github.com/mikaalnaik/TorontoBeach

torontobeachapi's People

Contributors

dependabot[bot] avatar kieran avatar mikaalnaik avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

kieran

torontobeachapi's Issues

Remove node_modules folder from git repository

For projects related to nodejs, the node_modulesfolder is not supposed to be committed to the git repository because

  1. Its contents are different for different operating systems
  2. It is very large
  3. It can be generated by each person from their computers

This issue can be resolved by basically following the steps below

  1. Add a file with the name .gitignore to the root folder of the project
  2. In the .gitignore file, type the text node_modules
  3. On the terminal of the root folder of the project, run git rm -f node_modules to remove the folder from git
  4. Stage and commit the changes
  5. Push the changes to the preferred branch

Cheers

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.