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

telemark/minelev-tjommi-api

Repository files navigation

Build Status js-standard-style

minelev-tjommi-api

Buddy compatible api service for MinElev

API

All API calls needs an Authorization header with valid jwt

GET /students?name={name}

Search all your students

GET /students/{id}

Get a specific student

GET /students/{id}/contactteachers

Get all contact teacher for a given student

GET /teachers

Get all teachers

GET /teachers/{id}

Get a given teacher

GET /teachers/{id}/contactclasses

Get all contact classes for a given teacher

GET /teachers/{id}/students

Get all students for a given teacher

GET /classes

Get all classes

GET /classes/{id}

Get a given class

GET /classes/{id}/students

Get all students in a class

GET /classes/{id}/teachers

Get all teachers in a class

GET /schools

Get all schools

GET /schools/{id}

Get a given school

GET /schools/{id}/teachers

Get all teachers for a given school

Get /schools/{id}/students

Get all students for a given school

Get /ping

Returns pong

Development

Add a local .env file

NODE_ENV=development
JWT_SECRET=jwt-secret-for-the-service
MONGODB_CONNECTION=mongodb-connection-string
MONGODB_COLLECTION=mongodb-collection-name
MONGODB_NAME=mongodb-name
LOGGED_IN_USER=username-for-testuser
PAPERTRAIL_HOST=papertrail-host
PAPERTRAIL_PORT=12345

Start the dev environment

$ npm run dev

In the utils directory you'll find a test call method.

Add the url you want to test and run the script

$ node utils/testcall.js

Deploy to ZEIT/Now

Configure now.json

Run the deployment script

$ npm run deploy

Run with docker

docker run -d \
  -p 3000:3000 \
  --env-file docker.env \
  --name tjommi-api \
  telemark/minelev-tjommi-api

Related

License

MIT