Boilerplate for an ES6 module that uses the Status.IU API.
For use as part of the JavaScript Community Workshop at Statewide IT 2019.
Before you start, check out the list of best practices for writing modules.
For this tutorial, create an ES6 class module that:
- Provides a
StatusService
class to encapsulate functionality for fetching a service's status - Provides an
async getAllNotices()
method that anonymously queries theGET /Notices
endpoint and returns aPromise
that resolves to an array of objects with the format specified in the linked docs page - Provides an
async getNotices(serviceId)
method that anonymously queries theGET /Services/{id}/Notices
endpoint and returns aPromise
that resolves to an array of objects with the format specified in the linked docs page - Provides an
async isRunning(serviceId)
method that returns aPromise
that resolves totrue
if there are noOngoing
orAlert
notices for the requested service
- The
getNotices()
andisRunning()
methods should check if the givenserviceId
is numeric andthrow
an error if it isn't (all Status.IU service IDs are numeric) - The module should not rely on an external HTTP library or jQuery to make
GET
orPOST
requests to the Status API - Include a
README.md
file that explains to developers how to use the module - Include DocBlock-style comments for your class methods similar to those used in the ES6 class module boilerplate