yieldparser icon indicating copy to clipboard operation
yieldparser copied to clipboard

Add rich router example with Response

Open RoyalIcing opened this issue 4 years ago • 0 comments
trafficstars

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 () => {
  }
}

RoyalIcing avatar Sep 15 '21 06:09 RoyalIcing