bones-mongoose API

Authentication

signup

curl -X POST http://localhost:5000/auth/MedicalCondition/signup -d name="FleshName" -d username="flesh" -d password="letmein"

Response:

{
    "_id": "5f4c3f8171342431cb677148",
    "permits": {
      "get": "ANON",
      "create": "ANON",
      "update": "ANON",
      "delete": "ANON"
    },
    "list": [],
    "name": "FleshName",
    "username": "flesh",
    "created": "2020-08-31T00:08:33.534Z",
    "thing": "Thing"
  }

login

curl -X POST http://localhost:5000/auth/login -d username="flesh" -d password="letmein"

Response:

{
    "_id": "5f4c3f8171342431cb677148",
    "name": "FleshName",
    "success": true,
    "username": "flesh",
    "token": "Bearer eyJhbGciOiJIUzI1NiIsInR...."
  }

Using Envvars:

set AUTH_RES (curl -X POST http://localhost:5000/auth/login -d username="flesh" -d password="letmein")
  set AUTH_RES (curl -X POST http://localhost:5000/auth/Thing/login -d username="flesh" -d password="letmein")
  set BEARER (string match -r '(?<=token\"\:\").*(?=\"\})' $AUTH_RES)
  set ENGAGED (string match -r '(?<=_id\"\:\").*(?=\"\})' $AUTH_RES)

logout

CRUD

engage

curl -X GET -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/"

Response:

{
    "permits": {
      "get": "ANON",
      "create": "ANON",
      "update": "ANON",
      "delete": "ANON"
    },
    "list": [],
    "_id": "5f4c3f8171342431cb677148",
    "name": "FleshName",
    "username": "flesh",
    "created": "2020-08-31T00:08:33.534Z",
    "thing": "Thing",
    "__v": 0
  }

update

curl -X GET -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/"

Response:

{
    "permits": {
      "get": "ANON",
      "create": "ANON",
      "update": "ANON",
      "delete": "ANON"
    },
    "list": [],
    "_id": "5f4c3f8171342431cb677148",
    "name": "FleshName",
    "username": "flesh",
    "created": "2020-08-31T00:08:33.534Z",
    "thing": "Thing",
    "__v": 0
  }

delete

curl -X DELETE -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/"

Response:

{
    "permits": {
      "get": "ANON",
      "create": "ANON",
      "update": "ANON",
      "delete": "ANON"
    }
  }

create

curl -X POST -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/MedicalCondition/" -d name="New MedicalCondition in List For $ENGAGED"

Response:

{
    "_id": "5f4c4b9671342431cb67714a",
    "permits": {
      "get": "ANON",
      "create": "ANON",
      "update": "ANON",
      "delete": "ANON"
    },
    "list": [],
    "name": "New MedicalCondition in List For $ENGAGED",
    "created": "2020-08-31T01:00:06.391Z",
    "createdBy": "$AUTHENTICATED",
    "god": "$ENGAGED",
    "thing": "MedicalCondition",
    "__v": 0
  }

list

curl -X GET -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/list/"

Response:

[
    {
      "_id": "5f4c4ace71342431cb677149",
      "name": "New Thing in List For $ENGAGED",
      "thing": "T"
    },
    {
      "_id": "5f4c4b9671342431cb67714a",
      "name": "New MedicalCondition in List For $ENGAGED",
      "thing": "MedicalCondition"
    }
  ]

Settings:

// `bones-mongoose/bones/settings.js`
  module.exports = {
    slim: {
      disambiguatingDescription: 1,
      name: 1,
    },
  }

listof

curl -X GET -H "Authorization: $BEARER" "http://localhost:5000/Thing/$ENGAGED/list/MedicalCondition/"

Response:

[
    {
      "_id": "5f4c4b9671342431cb67714a",
      "name": "New MedicalCondition in List For 5f4c3f8171342431cb677148",
      "thing": "MedicalCondition"
    }
  ]

Settings:

// `bones-mongoose/bones/settings.js`
  module.exports = {
    slim: {
      disambiguatingDescription: 1,
      name: 1,
    },
  }

Meta

schema

GET /schema/:engage/ Get the Meta Schema of type :engage.

curl -X GET -H "Authorization: $BEARER" "http://localhost:5000/schema/Thing/"

Response:

  {
      "disambiguatingDescription": {
        "type": "Text"
      },
      "name": {
        "type": "Text"
      }
    }

Settings:

  // `bones-mongoose/bones/settings.js`
    module.exports = {
      slim: {
        disambiguatingDescription: 1,
        name: 1,
      },
    }