Add rich router example with Response
Opened this issue · 0 comments
RoyalIcing commented
Include using URLSearchParams
function* GetHealth() {
yield '/health'
return async () => {
const sourceURL =
'https://cdn.jsdelivr.net/gh/RoyalIcing/yieldmachine@4478530fc40c3bf1208f8ea477f455ad34da308d/readme.md'
const sourceText = await fetch(sourceURL).then(res => res.text())
const html = md.render(sourceText)
return resHTML(html)
}
}
function* GetWithQuery() {
yield '/search'
const [rest] = yield /^[?].+/;
const query = new URLSearchParams(rest);
return async () => {
}
}