1.0.15 • Published 29 days ago
w-restapi v1.0.15
w-restapi
A REST API server with swagger.
Documentation
To view documentation or get support, visit docs.
Installation
Using npm(ES6 module):
Note:
w-restapi
is mainly dependent on@hapi/hapi
and@hapi/inert
.
npm i w-restapi
Example for w-restapi
:
Link: [dev source code]
import WRestapi from 'w-restapi'
function proc({ method, apiName, propName, propValue, payload, pm, req, res }) { //可由req內資訊做身份驗證
//resolve
pm.resolve(JSON.stringify({ method, apiName, propName, propValue, payload }))
console.log(method, apiName, propName, propValue, payload)
}
new WRestapi({ routes, proc })
//view swagger: http://localhost:8080/swdoc/index.html