Skip to content

telemark/micro-sikker-sone-queue

Repository files navigation

Build Status js-standard-style

micro-sikker-sone-queue

Microservice for queue

API

All API calls needs an Authorization header with valid jwt

$ curl -X GET -H "Authorization: Bearer <token>" https://queue.service.io/queue/next

PUT /queue

Add a new document to the queue

$ curl -X PUT -H "Authorization: Bearer <token>" --header "Content-Type: application/json" -d '{ "title": "Hello", "description": "World!" }' https://queue.service.io/queue

GET /queue/next

Get next document from queue

$ curl -X GET -H "Authorization: Bearer <token>" https://queue.service.io/queue/next

GET /queue/all

Get all documents in queue

$ curl -X GET -H "Authorization: Bearer <token>" https://queue.service.io/queue/all

DELETE /queue/:id

Deletes document from queue

$ curl -X DELETE -H "Authorization: Bearer <token>" https://queue.service.io/queue/5af938ee51450ae8f3b17e5f

Development

You'll need the now-cli installed

  • clone the repo
  • install dependencies
  • add a .env file
  • start the service with now-dev $ now dev

.env

NODE_ENV=development
MONGODB_CONNECTION=connection-to-a-mongodb-compatible-api
MONGODB_COLLECTION=notes
MONGODB_NAME=secure-queue
JWT_SECRET=whatever-you-want
PAPERTRAIL_HOST=does-not-matter-in-dev-mode
PAPERTRAIL_PORT=does-not-matter-in-dev-mode
PAPERTRAIL_HOSTNAME=does-not-matter-in-dev-mode

Deployment - ZEIT/Now

Change content of now.json to match your environment.

Deploy service.

$ npm run deploy

License

MIT