Skip to content
This repository has been archived by the owner on Nov 5, 2020. It is now read-only.

telemark/micro-portalen-shortcuts

Repository files navigation

Build Status js-standard-style

micro-portalen-shortcuts

Micro-version of shortcuts administration.

Returns an array of shortcut objects dependening on your roles and ip.

API

/shortcuts

Lists all shortcuts

To filter by roles

GET

?roles=<role1>|<role2>|<role3>

POST

{
  roles: [
    'role1',
    'role2',
    'role3'
  ]
}
$ curl http://localhost:3000/shortcuts -d '{"roles": ["skole"]}' --header "Content-Type: application/json"

To filter by ip

GET

?myIp=127.0.0.1

POST

{
  myIp: '127.0.0.1'
}

/view

Renders html of all shortcuts

To filter by roles

GET

?roles=<role1>|<role2>|<role3>

POST

{
  roles: [
    'role1',
    'role2',
    'role3'
  ]
}

To filter by ip

GET

?myIp=127.0.0.1

POST

{
  myIp: '127.0.0.1'
}

Development

You'll need the now-cli installed to do local development.

  • Clone the repo
  • Install the dependencies $ npm i
  • Start the development server $ npm run dev

Add a new shortcut

  {
      "title": "The shortcuts title",
      "description": "Shortcuts description (keep it short)",
      "system": "What system is the shortcut leading to",
      "url": "Url for the shortcut",
      "icon": "Name for the shortcut icon", // From https://material.io/resources/icons/?style=baseline
      "includeIps": [
        "10.0.*.*", // Support wildcards for range
        "172.16.0.0" // Supports full address
      ] //This optional. Must be an array. If the shortcut is available for all IPs remove the property
    }
  • Redeploy

Remove a shortcut

Deploy

Make sure the now.json matches your environment.

Run the deploy script.

$ npm run deploy

License

MIT