Giter VIP home page Giter VIP logo

sctask's Introduction

SCTASK

Installation

Requirements

  • Node.JS 8.0 and up

Setup ( run the commands in this order)

Key points

  • Base url : http://localhost:3000/ . All apis needed to be just appended to this url. For example : http://localhost:3000/api/login
  • visit http://localhost:3000/api-docs to access the interactive swagger documentation.
  • custom eslint configuration has been used as linter.
  • 'npm run make_env' command makes a .env file which stores secret. This is only for development purpose and not for production
  • 'npm test' shows code coverage using istanbul.js

APIs USAGE

POST /api/login

  • 'username' and 'password' are two string type required json payloads
  • On success, it returns an object containing jwt token which should be sent along with other protected routes.
# PAYLOAD
{
	"username":"user",
	"password":"pass"
}

# OUTPUT
{
    "success": true,
    "message": "successfully logged in",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InVzZXIiLCJwYXNzd29yZCI6InBhc3MiLCJpYXQiOjE1Mzg5MzI2NDIsImV4cCI6MTUzOTAxOTA0Mn0.RH6OBojXMNfRHF6PB4u6fLWBsExzI3P2KApMwrrFW18"
}

POST /api/apply_patch

  • Payload contains 'doc' is a json while 'patch' is an array of objects.
  • Set 'Authorization' Header as "Bearer token" where token is the same as obtained as payload after logging in. Token expires in 24hours.
  • This applies the patch to the doc to give back the patched json.
# PAYLOAD
{ 
"doc" : {
  "baz": "qux",
  "foo": "bar"
},
"patch":[
  { "op": "replace", "path": "/baz", "value": "boo" },
  { "op": "add", "path": "/hello", "value": ["world"] },
  { "op": "remove", "path": "/foo" }
]
}

# OUTPUT
{
    "success": true,
    "message": "successfully patched the json object",
    "patcheddoc": {
        "baz": "boo",
        "hello": [
            "world"
        ]
    }
}

POST /api/thumbnail

  • Payload contains 'url' as a string which is the public url of the image to be downloaded.
  • Set 'Authorization' Header as "Bearer token" where token is the same as obtained as payload after logging in. Token expires in 24hours.
  • Make sure the proxy is set/unset as required since it will fetch the image from a url.
  • The image at url is resized to 50*50 pixels and sent back as response.
  • visit this link in browser for interactive documentation enabled via swagger-ui.

sctask's People

Contributors

tarun-bathwal avatar

Watchers

James Cloos avatar  avatar

Forkers

shubhankerism

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.