by Before Semicolon

Static Data

Static data is any data you provide through the initial engine configuration when the server runs.

This data is kept unchanged and every template file is given access to it.

const {engine} = require('@beforesemicolon/html-plus');

const app = express();

engine(app, path.resolve(__dirname, './pages'), {
	staticData: {
		site: {
			version: "2.4.1",
			license: "MIT"

Inside the template you can reference this data by using $data variable.

	<p>version {$}, license {$}</p>

Static data is an excellent place to provide data fetched from databases or somewhere in the cloud when server is starting. Any data can be made available to all templates using the staticData engine option.