An extension for selecting cached views.
- View selection, render and request end.
- A reloadable view cache.
- Automatic header inserts on load.
- Predefined handler configurations.
npm install @serverful/views
const Views = require("@serverful/views");
// ...
Register the plugin and configure the view directory.
Serverful.Extension(Views(Content, Headers?));
Insertion of predefined headers.
// Headers/Navbar.html
<div>
<a href="#">Home</a>
<a href="#">Github</a>
</div>
// Views/Index.html
<serverful navbar>
Handle a request using by selecting a view.
MyServer.Incoming(Packet => {
// Information processing...
Packet.Request.View("/internal/embed");
});
This module is licensed under Apache 2.0.