Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Router Object

HARADA Koichi edited this page Apr 26, 2020 · 1 revision

Router

Constructor

Router new Router ()

Name Type Description
return object Router object

This method creates and returns a Router object.

It can be used to create a group of route definition.

This function just creates a Rouer object on memory. So you must register it to the main application using HttpServer.use(Router) or VirtualHost.use(Router) function after you've finished to add routes to the Router.

Example

C_OBJECT($app_o;$router_o)
$app_o:=new HttpServer

$router_o:=new Router()
$router_o.get("/bar";Formula(ApiMethodName))

$app_o.use("/foo";$router_o)

In the above case, the get request path "/foo/bar" will invoke ApiMethodName method.

Properties

Methods

Route configuration

The Router object has the same routing functions with HttpServer object.

For detail description on each function, please refer to HttpServer page.

Functions provided with this object are:

Router.all()
Router.delete()
Router.get()
Router.method()
Router.post()
Router.put()
Router.route()
Router.use()


Clone this wiki locally