npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

verdandi

v2.15.2

Published

Verðandi; API backend for Sjekk UT mobile application

Downloads

27

Readme

Verðandi

Build status Codacy grade Codacy coverage NPM downloads NPM version Node version Dependency status

API backend server for the Sjekk UT mobile application.

From the Old Norse Verðandi meaning "becoming, happening". Verdandi was one of the three Norns, or goddesses of destiny, in Norse mythology. She was responsible for the present.

                                        Thence come maidens
                                            much knowing
                                        three from the hall
                                    which under that tree stands;
                                         Urd hight the one,
                                        the second Verdandi,
                                      on a tablet they graved,
                                          Skuld the third;
                                       Laws they established,
                                            life allotted
                                         to the sons of men,
                                        destinies pronounced.

Getting started

Download Docker for Mac or Windows.

Run in this directory:

$ docker-compose up

Test

docker-compose run --rm node npm run test
docker-compose run --rm node npm run lint

Environment variables

  • CHECKIN_MAX_DISTANCE=200 - Used to validate a users proximity to the coordinates it's checking in to. Distance in meters.
  • CHECKIN_TIMEOUT=86400 - Used to validate that a user is not checking in to the same place more often than this timeout allows. Time in seconds.

API

Authentication

Some API endpoints requires the following user authentication headers:

  • X-User-Id - DNT Connect User ID
  • X-User-Token - DNT Connect OAuth 2 token

Response codes

Unless otherwise statet API endpoints will return the following HTTP status codes:

  • 200 Ok - Successfull GET request
  • 201 Created - Successfull POST or PUT request
  • 204 No Content - Successfull HEAD or DELETE request
  • 400 Bad Request - Bad user supplied data
  • 401 Unauthorized - Missing or invalid user authentication
  • 403 Forbidden - Missing or invalid user permissions
  • 404 Not Found - Resource or endpoint not found
  • 500 Internal Server Error - Internal server error
  • 501 Not Implemented - API endpoint is not implemented yet

GET /v2/

Status codes:

Returns 200 Ok and an API index on successfull request.

GET body:

  • number checkin_new.rules.max_distance - Max distance in meters a user can have to the place it is checking in to.
  • number checkin_new.rules.quarantine - A user can not check in twice to the same place within this period. Time in seconds.

Example:

GET /v2 HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "checkin_new": {
    "url": "https://sjekkut.app.dnt.no/api/v2/steder/{sted}/besok",
    "rules": {
      "max_distance": 200,
      "quarantine": 86400
    }
  },
  "checkin_get": {
    "url": "https://sjekkut.app.dnt.no/api/v2/steder/{sted}/besok/{oid}"
  },
  "checkin_log": {
    "url": "https://sjekkut.app.dnt.no/api/v2/steder/{sted}/logg"
  },
  "checkin_stats": {
    "url": "https://sjekkut.app.dnt.no/api/v2/steder/{sted}/stats"
  },
  "profile_view": {
    "url": "https://sjekkut.app.dnt.no/api/v2/brukere/{bruker}"
  },
  "list_join": {
    "url": "https://sjekkut.app.dnt.no/api/v2/lister/{liste}/blimed"
  },
  "list_leave": {
    "url": "https://sjekkut.app.dnt.no/api/v2/lister/{liste}/meldav"
  },
  "list_log": {
    "url": "https://sjekkut.app.dnt.no/api/v2/lister/{liste}/logg"
  }
}

GET /v2/steder/{sted}/stats

Status codes:

Returns 200 Ok on successfull request.

Example:

GET /v2/steder/524081f9b8cb77df15001660/stats HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "data": {
    "count": 2,
  }
}

GET /v2/steder/{sted}/logg

Status codes:

Returns 200 Ok on successfull request.

Example:

GET /v2/steder/524081f9b8cb77df15001660/logg HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "data": [
    {...},
    {...}
  ]
}

POST /v2/steder/{sted}/besok

Status codes:

  • 201 Created on successfull checkin.
  • 400 Bad Request on validation error.

POST body:

  • number lat - decimal latitude (required)
  • number lon - decimal longitude (required)
  • boolean public - (default false)
  • string timestamp - date and time ISO 8601 (default Date.now())

Example:

POST /v2/steder/524081f9b8cb77df15001660/besok HTTP/1.1
Accept: application/json
X-User-Id: 123
X-User-Token asdf123

{
  "lat": 12.3456,
  "lon": 98.7654,
  "public": true,
  "timestamp": "2016-09-06T12:27:21.594Z"
}

HTTP/1.1 201 Created
Content-Type: application/json
Location: /v2/steder/524081f9b8cb77df15001660/besok/1234-123-123-1234

{
  "message": "Ok",
  "data": {...}
}

GET /v2/steder/{sted}/besok/{oid}

Status codes:

Returns 200 Ok for valid checkin.

Example:

GET /v2/steder/524081f9b8cb77df15001660/besok/1234-123-123-1234 HTTP/1.1
Accept: application/json

HTTP/1.1 200 Ok
Content-Type: application/json

{
  "data": {...}
}

GET /v2/brukere/{bruker}

Status codes:

Returns 200 Ok on successfull request.

Example:

GET /v2/brukere/1234 HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "data": {...}
}

POST /v2/lister/{liste}/blimed

Add the list id to current user's lister array.

Status codes:

Returns 200 Ok on successfull request.

Example:

POST /v2/lister/300000000000000000000001/blimed HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "message": "Ok",
  "data": {...}
}

POST /v2/lister/{liste}/meldav

Remove the list id from current user's lister array.

Status codes:

Returns 200 Ok on successfull request.

Example:

POST /v2/lister/300000000000000000000001/meldav HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "message": "Ok",
  "data": {...}
}

GET /v2/lister/{liste}/logg

Status codes:

Returns 200 Ok on successfull request.

Example:

GET /v2/lister/57974036b565590001a98884/logg HTTP/1.1
Accept: application/json

HTTP/1.1 Ok
Content-Type: application/json

{
  "data": [
    {...},
    {...}
  ]
}

MIT lisenced