0.3.2 • Published 4 years ago

httpsrv v0.3.2

Weekly downloads
56
License
MIT
Repository
github
Last release
4 years ago

httpsrv

A simple http file server

Usage

npm i -g httpsrv #yarn global add httpsrv
httpsrv .

then open localhost:3333

Options

Usage: httpsrv <basedir>

Options:
  --help              Show help                                        [boolean]
  --version           Show version number                              [boolean]
  --port, -p          Port to listen                    [number] [default: 3333]
  --log, -l           Enable logger                                    [boolean]
  --indexhtml, -i     Try to show index.html if exists                 [boolean]
  --instantclick, -x  disable instantclick.js in directory page
                                                       [boolean] [default: true]
  --cors, -c          Access-Control-Allow-Origin header                [string]
  --fallback, -f      A file will be send when 404, useful in SPA (will disable
                      directory listing page)                           [string]

Examples:
  httpsrv . -p 8888  Start server on port 8888

API (cli.js)

#!/usr/bin/env node
const createServer = require('./index') //require('httpsrv')
const { _: [basedir], port, log, cors, fallback, indexhtml } = require('yargs')
  .usage('Usage: $0 <basedir>') //many things....

//options same as cli options, return an express app
const app=createServer({ basedir, log, cors, fallback, indexhtml , instantclick })
app.listen(port, _ => console.log(`listen on *:${port}`))
0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago