Emerap RA ☀️
Synopsis
Customizing Rest API builder
API reference
call(req, res, [method])
req
: required Instance of http.IncomingMessageres
: required Instance of http.ServerResponsemethod
: Method name, (default value fromreq.params.method
)
Return object as Promise.
definition(obj)
obj
: required Definition reference
name: 'methodName' args: paramName: dataType: 'dataTypeName' { return promise or value }
datatype(obj)
obj
: required Datatype reference
type: 'datatypeName' { return promise or value }
Quick start
Open terminal and run command
mkdir ra-test && cd ra-test && npm init -y && touch app.js && npm install express ra --save
Paste code into app.js and save changes
const express = ;const app = ; const ra = ;const api = ; api; api; appall'/ra/method/:method' { api; }; app;
Start app in terminal
node app.js
© Alexander Pokhodyun (Karbunkul) 2017