# NOT RUN {
methodical <- route(
c('GET', 'POST'),
'^',
function(req) {
res <- response()
if (method(req) == 'GET') {
# handle when method is GET
body(res) <- 'I got ya'
} else {
body(res) <- 'Washingtong or Huffington?'
}
res
}
)
methodical_m <- mockup(methodical)
res <- methodical_m('GET', '/')
res
res <- methodical_m('POST', '/')
body(res)
# }
Run the code above in your browser using DataLab