Skip to content

Sample Microservice supporting jwt, json_patching and thumbail generation

Notifications You must be signed in to change notification settings

coderkant/thumbnail_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JWT, Json patch and sharp example in Node

Hi All. This is a webservice with three endpoints:

  • host: localhost
  • port: 8000

endpoints:

  • POST /login : include any username/password (in json body) to get a JWT. Sample request body: {username: any, password : any}

  • POST /apply_json_patch : send a JSON and a patch object and get the patched result back. Include the JWT recieved earlier. Sample request body: {theObject : theObject, thePatch : thePatch}

  • POST /create_thumbnail : send a url of a public photo to get back a 50x50 thumbnail. Include the JWT recieved earlier. Sample request body: {url: publicImageUrl} (use this subject for most aesthetic results; https://www.google.co.in/search?q=emma+watson&tbm=isch)

  • GET /metrics: Monitor the application. Use Admin Login. {username:admin , password:admin}

Installation Instructions.

  1. Clone this repository and run npm i.
  2. Configure port by setting PORT_NUM and logging levels by setting LOG_LEVEL environment variables. (optional)
  3. Provide Admin credentials as ADMIN_USER and ADMIN_PASS env variables. (optional)
  4. Run npm test to run tests and npm start to start the server.

Additional info.

  1. Run docker build -t coderkant/jwt_node . to build docker image.
  2. Run the image using docker run -p PORT_OF_CHOICE:8000 -d coderkant/jwt_node

About

Sample Microservice supporting jwt, json_patching and thumbail generation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published