/micro-bigfive-save

micro webservice that stores bigfive answers

Primary LanguageJavaScriptMIT LicenseMIT

Build Status js-standard-style

micro-bigfive-save

micro webservice stores bigfive answers

Example

https://save.bigfive.world

Add data

Request

POST /

$ curl -v -H "Authorization: INSERT-JWT-TOKEN" http://localhost:3000 -d '{"someData": "this is posted to database" }'

PUT /:id

$ curl -v -H "Authorization: INSERT-JWT-TOKEN" http://localhost:3000/58a475c47bd88a143a79d4a2 -X PUT -d '{"someData": "this is posted to database" }'

Response

{
  "id": "58a475c47bd88a143a79d4a2"
}

Get all data

Request

GET /search

$ curl -v http://localhost:3000/search

Response

[  
  {  
    "_id":"58a474c4fa5fdf11fe3176e4",
    "testType":"personality",
    "langCode":"no",
    "data":{  
      "O":{  
        "score":33,
        "count":10,
        "result":"positive",
        "facet":{  

        }
      },
      "N":{  
        "score":21,
        "count":10,
        "result":"negative",
        "facet":{  

        }
      },
      "E":{  
        "score":31,
        "count":10,
        "result":"positive",
        "facet":{  

        }
      },
      "C":{  
        "score":31,
        "count":10,
        "result":"positive",
        "facet":{  

        }
      },
      "A":{  
        "score":30,
        "count":10,
        "result":"neutral",
        "facet":{  

        }
      }
    }
  }
]

Get some data

Request

GET /?id=58a475c47bd88a143a79d4a2

$ curl -v http://localhost:3000/?id=58a475c47bd88a143a79d4a2

Response

Same as get all data

Delete data

DELETE /:id

$ curl -v -H "Authorization: INSERT-JWT-TOKEN" -X DELETE -v http://localhost:3000/58a475c47bd88a143a79d4a2

Response

{
  "id": "58a475c47bd88a143a79d4a2"
}

Deploy to Now

now secret add BIGFIVE_SAVE_DATABASE_URL something.mlab.com
now secret add BIGFIVE_SAVE_DB bigfive
now secret add BIGFIVE_SAVE_USER bigfive
now secret add BIGFIVE_SAVE_PASSWORD password
now secret add BIGFIVE_SAVE_PORT 53659
now secret add BIGFIVE_SAVE_TOKEN_KEY "Gibberish, jibberish, jibber-jabber and gobbledygook"
now -E results.env

License

MIT

About

Created with ❤️ by zrrzzt and maccyber

alt text alt text