Nautical Pea Maker

    @augmt/timestamp-microservice

    0.3.1 • Public • Published

    Timestamp Microservice

    Convert date strings to Unix timestamps and a natural language (RFC-1123) format.

    How it Works

    This microservice uses Moment to validate input and format output and koa-router to capture path parameters and, along with Koa, serve requests.

    Valid Formats

    Format Example
    Unix Timestamp 1450137600
    ISO-8601 2015-12-25

    Note: Unix timestamps have precedence over the ISO-8601 format, so a string such as "20130208" will be parsed as a unix timestamp.

    How to Use

    app.js exports a Koa app. Koa apps have an app.listen() method that is identical to Node's http.Server.listen().

    Import app.js and call app.listen() to start up the microservice.

    API Resources

    GET /

    Returns a Timestamp object based on the current time.

    REQUEST

    Sample: https://timestamp-microservice.example.com/

    RESPONSE

    Status: 200 - application-json

    Response:

    {
      "unix": 1498953600,
      "natural": "Sun, 02 Jul 2017 00:00:00 GMT"
    }
    

    GET /:date

    Returns a Timestamp object based on date.

    REQUEST

    Sample: https://timestamp-microservice.example.com/1450137600

    RESPONSE

    Status: 200 - application-json

    Response:

    {  
      "unix": 1450137600,
      "natural": "Tue, 15 Dec 2015 00:00:00 GMT"
    }
    

    Keywords

    none

    Install

    npm i @augmt/timestamp-microservice

    DownloadsWeekly Downloads

    3

    Version

    0.3.1

    License

    MIT

    Unpacked Size

    4.84 kB

    Total Files

    6

    Last publish

    Collaborators

    • augmt