A simple stateless microservice in Node.js, with three major functionalities:
- Authentication
- JSON patching
- Image Thumbnail Generation
A login request body that contains an arbituary username/password pair that returns a signed Json Web Token to access specific end points.
{
"username": string,
"password": string
}
{ "message": "Successfully signed up" }
{
"username": string,
"password": string
}
{
"message": "User signed in successfully",
"token": string
}
Request body contains a JSON object and a JSON patch object, which returns a formatted or patched JSON object.
{
"jsonObj": {
"firstName": "Segun",
"lastName": "David",
"gender": "male",
"age": 25,
"status": "happy"
},
"jsonPatchObj": [
{"op": "add", "path": "/status", "value": {"location": "Lagos"}},
{"op": "remove", "path": "/status"},
{"op": "replace", "path": "/age", "value": 90},
{"op": "copy", "from": "/firstName", "path": "/lastName"},
{"op": "move", "from": "/firstName", "path": "/gender"}
]
}
{
"message": "Data Edited",
"patchedDoc": {
"lastName": "Segun",
"gender": "Segun",
"age": 90
}
}
Request body contains a public image url. The image is downloaded, resized and saved to 'thumbnails'
{ "uri": "https://cdn.pixabay.com/photo/2020/06/01/10/02/puffin-5246026_960_720.jpg" }
Thumbnail