@sovietxd/nhp

1.1.7 • Public • Published

Node.JS Hypertext Preprocessor

Package Version

What is it?

Node.JS Hypertext Preprocessor is a fast hypertext preprocessor 'aka PHP'.

Example of usage

const path = require('path');
const express = require('express');
const app = express();
const port = process.env.PORT || 3000
const NHP = require('@sovietxd/nhp');

var nhp = new NHP(); // Create NHP object
var nhpCtx = {       // Create NHP context object (these properties will be available under $ object in all .nhp scripts)
	"process": process,
	"app": app
}

nhp.setWebMap(nhp.genWebMap(path.join(__dirname, 'www'))); // Set main directory to ./www

app.use('/', nhp.bind(nhpCtx)); // Use NHP handler

app.listen(port, () => {})

License

NHP is licensed under GPL 2.0

Package Sidebar

Install

npm i @sovietxd/nhp

Weekly Downloads

0

Version

1.1.7

License

GPL-2.0-only

Unpacked Size

26.6 kB

Total Files

8

Last publish

Collaborators

  • sovietxd