Skip to content

Instantly share code, notes, and snippets.

@kristoferjoseph
Last active August 31, 2021 20:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kristoferjoseph/f94d4785e545b4c6419973d478aa4c8e to your computer and use it in GitHub Desktop.
Save kristoferjoseph/f94d4785e545b4c6419973d478aa4c8e to your computer and use it in GitHub Desktop.
Enhance page api dream boat
// Function name would be the page name
export async function Main(html, data) {
return html`<my-custom-element todos="${data.todos}"></my-custom-element>`
}
@kristoferjoseph
Copy link
Author

kristoferjoseph commented Aug 31, 2021

// http function inside get /main
import scopedData as data from '@begin/data'
import enhance from '@enhance/enhance'
const html = enhance({
  templates: '@architect/views/templates',
  modules: 'components'
})

import Main from '/main'

export async function handler(req) {
  return {
     body: await Main(html, data)
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment