Create a renderTemplate method that returns a rendered string
Closed this issue · 0 comments
uptownhr commented
Create a renderTemplate utility function that accepts data
and template
as parameters and returns a rendered string utilizing Vue's SSR, renderToString method.
AC
- Create a unit test of the renderTemplate function that demonstrates the ability to render a template
Example from vue documents https://vuejs.org/api/ssr.html#rendertostring
import { createSSRApp } from 'vue'
import { renderToString } from 'vue/server-renderer'
const app = createSSRApp({
data: () => ({ msg: 'hello' }),
template: `<div>{{ msg }}</div>`
})
;(async () => {
const html = await renderToString(app)
console.log(html)
})()