1.0.1 • Published 8 years ago

express-html v1.0.1

Weekly downloads
13
License
ISC
Repository
github
Last release
8 years ago

Output the static file in the www directory

express-html install

npm i express-html --save-dev

express-html usage

/**
 * apple-touch-icon.png, favicon.ico demo
 */

// express
const express = require('express');

// express app instance
const app = express();

// ExpressHTML instance
const html = require('express-html');

// www root dir
const root = __dirname;

// mount app and set html file paths
html.use(app, root)
    // requrest uri is identical with filename
    .add('favicon.ico')
    // rewrite to realpath
    .add({'favicon.png': 'static/img/favicon.ico'})
    // file path list
    .add(['robots.txt', 'sitemap.xml'])
    // mixed path list
    .add(['apple-touch-icon.png', {'apple-touch-icon-precomposed.png': 'apple-touch-icon.png'}])
    // other format files
    .add('google-verify.html');
1.0.1

8 years ago

1.0.0

8 years ago