neobiz-express
v3.0.1
Published
middleware to use neobiz.js as view engine in express
Downloads
4
Maintainers
Readme
read example.js file
import express from "express";
import neoex from "neobiz-express";
const app = new express();
neoex(app, "./view"); //@params expressApp, path2view
app.get("/", (req, res) => {
// no need to write .js, actually don't
res.render("landing.v", { title: "data" });
});
res.render(
// views
({ username }) => ({
h1: { text: "Hello world! " + username },
}),
// passing value
{
template: "t.v", //use template
title: "on the go",
username: "dim24",
}
);
templates
res.render("landing.v", { title: "data", template: "main.v" });
main.js
module.exports = (contents, { title }) => ({
head: { title: { text: title } },
body: contents, //child
});