@dankolz/page-prerun-data-loader

1.0.0 • Public • Published

Page Prerun Data Loader

A plugin for the webhandle framework. Allows a page to request that JSON data files be loaded for use by templates on the page.

Install

npm i @dankolz/page-prerun-data-loader

Usage

When the environment is setup, to use the default directory (data), run:

require('@dankolz/page-prerun-data-loader')()

For any page wishing to load data, they should include something like this in their page json.

{
	"title": "Pre Run Data Loader",
	"dataFiles": [
		{
			"name": "testData",
			"location": "test1.json"
		}
	]
}

The dataFiles section will cause the file data/test1.json to be loaded, parsed as JSON, and put in the variable res.locals.testData.

/@dankolz/page-prerun-data-loader/

    Package Sidebar

    Install

    npm i @dankolz/page-prerun-data-loader

    Weekly Downloads

    0

    Version

    1.0.0

    License

    ISC

    Unpacked Size

    3.12 kB

    Total Files

    4

    Last publish

    Collaborators

    • dankolz