mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added streaming example to the Sample Code section
This commit is contained in:
parent
88702b2514
commit
c9815aeddc
14
README.md
14
README.md
@ -140,6 +140,19 @@ Hello World!
|
||||
<div>No colors!</div>
|
||||
```
|
||||
|
||||
The streaming API can be used to stream the output to an HTTP response stream or any other writable stream. For example, with Express:
|
||||
|
||||
```javascript
|
||||
var template = require('raptor-templates').load(require.resolve('./template.rhtml'));
|
||||
|
||||
app.get('/profile', function(req, res) {
|
||||
template.stream({
|
||||
name: 'Frank'
|
||||
})
|
||||
.pipe(res);
|
||||
});
|
||||
```
|
||||
|
||||
Raptor Templates also supports custom tags so you can easily extend the HTML grammar to support things like the following:
|
||||
|
||||
```html
|
||||
@ -1286,7 +1299,6 @@ app.get('/profile', function(req, res) {
|
||||
})
|
||||
.pipe(res);
|
||||
});
|
||||
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user