add_route: add_route: add new route to a router

Description Usage Arguments Details Value Examples

Description

A description of add_route

Usage

1
2
3
4
5
6
7
add_route(router, method, endpoint, fun)

## Default S3 method:
add_route(router, method, endpoint, fun)

## S3 method for class 'router'
add_route(router, method, endpoint, fun)

Arguments

router

router class

method

http verb such "GET", "POST", "PUT" or "DELETE"

endpoint

string e.g. "/add/", slashes are important!!

fun

function

Details

A details of add_route

Value

router

Object

Object

Examples

1
2
3
4
5
6
7
8
r <- router()
r <- add_route(r,
    method = "GET",
    endpoint = "/add/",
    fun = function(a, b) {
        return(as.numeric(a) + as.numeric(b))
    }
)

gabaligeti/routeR documentation built on May 20, 2019, 1:28 p.m.