evheniy / yeps-index

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YEPS index

YEPS Static index.html file serving

NPM

npm version Build Status Coverage Status Linux Build Windows Build

Dependency Status devDependency Status NSP Status

License GitHub stars GitHub forks GitHub issues Twitter

How to install

npm i -S yeps-index debug

How to use

const App = require('yeps');
    
const index = require('yeps-index');
    
const error = require('yeps-error');
const logger = require('yeps-logger');
const server = require('yeps-server');
    
const { resolve } = require('path');
    
const app = new App();
    
app.all([
  error(),
  logger(),
  index({
    root: resolve(__dirname, 'dist'),
  }),
]);
    
server.createHttpServer(app);

Or with options:

app.all([
  error(),
  logger(),
  serve({
    root: resolve(__dirname, 'dist'),
    index: 'index.html',
    url: '/',
  }),
]);

Url "/index.html" will be redirected to "/" with 301 http code.

YEPS documentation

About

License:MIT License


Languages

Language:JavaScript 97.3%Language:HTML 2.7%