-
-
Notifications
You must be signed in to change notification settings - Fork 0
Module: REST
Aviril edited this page Sep 6, 2022
·
9 revisions
REST APIs are software interface that allows you to GET
, PUT
, POST
& DELETE
data via HTTP(s) queries and establish connection b/w client & the server. It’s based on RESTful technology, an architectural style, and a communication strategy that’s common in web services development. Rest APIs are widely used due to its flexibility, scalability and ease of integration in everyday web applications. However, express-js
doesn't let you create/destroy dynamically allocated REST APIs which can be achieved via vNetwork's REST API implementation.
const object: result = server.rest.fetch(
string: type, // Type could be either of "post", "get", "put", "delete"
string: route,
object: data // Required for "post" & "put" types
)
const bool: isRouteVoid = server.rest.isVoid(
string: type,
string: route
)
const bool: state = server.rest.create(
string: type, // Type could be either of "post", "get", "put", "delete"
string: route,
function: exec // Route's request handler
)
const bool: state = server.rest.destroy(
string: type,
string: route
)
server.rest.onMiddleware = function(
object: request,
object: response,
function: next
) {}