View source: R/jsonapi_server.R
| jsonapi_server | R Documentation |
Start a JSONAPI server
jsonapi_server(port = 8000)
port |
(integer) the port to run the server on. default: 8000 |
Right now, this function doesn't take arbitrary input, but
instead serves the same content as this JSON API example
https://github.com/endpoints/endpoints-example . Note that not all
features are the same as the full endpoints-example, but most
should work.
Right now, this function serves data from static, minified JSON files, so there's no dynamic database underneath.
Kill the server by CTRL+C, ESC or similar.
## Not run:
if (interactive()) {
# start a server in another R session
jsonapi_server()
# Back in this session ...
# Connect
(conn <- jsonapi_connect("http://localhost:8000"))
# Get data
conn$url
conn$version
conn$content_type
conn$routes()
conn$route("authors")
conn$route("chapters")
conn$route("authors/1")
conn$route("authors/1/books")
conn$route("chapters/5")
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.