@cl-live-server/static-server-handler
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

@cl-live-server/static-server-handler

Middleware handler used by @cl-live-server/live-server, essentially to inject HTML (with some JavaScript) into a response given a HTML request.

Install

yarn add @cl-live-server/static-server-handler

Usage

import path from 'path';
import staticServerHandler from '@cl-live-server/static-server-handler';

const rootPath = './path/to/some/folder/or/file';
const injectRoot = __dirname;
const injectTarget = 'index.html';
// default values                  '.'        __dirname   '../index.html'
const handler = staticServerHandler(rootPath, injectRoot, injectTarget);

// setup server, for example with 'connect'
const app = connect();

// register handler
app.use(this.staticServerHandler);

Package Sidebar

Install

npm i @cl-live-server/static-server-handler

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

13.2 kB

Total Files

17

Last publish

Collaborators

  • christianlindeneg