Closed patrick-steele-idem closed 7 years ago
Thanks @davidenq! I probably won't have a chance to take a closer look until next week, but I'm thinking we should stick with the componentized directory structure with a src/components/
directory and a src/pages/
directory. Thoughts?
I'm agree. I'll work on a new tutorial. Have a great weekend!
If you want to adjust the response type:
server.route({
method: 'GET',
path: '/',
handler: function (request, reply) {
reply(index.stream({'message': 'hello world!'})).type('text/html');
}
});
Thanks for sharing @jsumners, I updated the Hapi docs to correctly set the content type header: https://github.com/marko-js/marko/commit/951c0dc906677725e3083061dbd2ae2575205d2c
Both .render
and .stream
are very useful, However they are deprecated. Is it OK to still use them with hapi? Is there a better option?
Added sample: https://github.com/marko-js-samples/marko-hapi
Example
Install hapi and marko
directory structure:
Server side rendering
index.js
index.marko
master.marko
header.marko
aside.marko
footer.marko
execute
Open your browser and visit http://localhost:8000
gives the following output
Clone the example
example-hapi-marko