application: Create an Application

Description Usage Arguments Details See Also Examples

Description

A prairie application, simply put, is a list of route objects. When creating an application, ... may be any combination of R objects with a as.route implementation, see details.

Usage

1
2
3
4
5

Arguments

...

R objects, coerced to routes.

Details

In order for prairie to best help R programmers grow web applications from their existing code many coercion generics have been created and are available for implementation. The, arguably, most important of generic is as.route. CRAN is ripe with packages which include custom S3 classes. prairie aims to provide a streamlined process for serving these classes across the web. An implementation of as.route might choose a resouce path based on a class attribute or choose the HTTP method based on object permissions (GET for a read-only database connection or GET and POST for a read/write connection).

Furthmore, prairie is meant to work on top of, around, and with existing R code. While writing a good implementation of as.route may take time, if this package is succesful, one will not need to modify existing code. You have worked hard on your code and prairie is along to grow that code onwards to the web.

See Also

as.route, run

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
app(
  route(
    'GET',
    '^',
    function(req) {
      res <- response()
      body(res) <- 'Hello, world!'
      res
    }
  )
)

nteetor/prairie documentation built on May 24, 2019, 9:56 a.m.