inst/basic/app.R

library(ambiorix)
import("views")

app <- Ambiorix$new()

# 404 page
app$not_found <- render_404

# serve static files
app$static("assets", "static")

# homepage
app$get("/", render_home)

# about
app$get("/about", render_about)

# websocket 
app$receive("hello", function(msg, ws){
  print(msg)
  ws$send("hello", "Hello back! (sent from R)")
})

app$start()
devOpifex/ambiorix.generator documentation built on May 19, 2024, 6:11 a.m.