Title

Global

Methods

# GetFileType(Filename) → {string}

Get content type of the file name for http header.

Parameters:
Name Type Description
Filename string

Filename to get header content type.

View Source GetFileType/index.js, line 15

Filetype

string
Example
const { GetFileType } = require("lite-web-server")
var filetype = GetFileType("main.js")

Type Definitions

object

# WebServerOptions

WebServer's options.

Properties:
Name Type Attributes Default Description
options object <optional>
port Number <optional>
3000

Port to host the page.

directory string <optional>
./public/

The directory to load the file.

serveindex boolean <optional>
false

If it's true, return the file list of the directory when the directory was requested. (If index.html exists in the directory, it will be sent preferentially)

acceptonlyget boolean <optional>
true

Only accepts get request.

useindexhtml boolean <optional>
true

If it's true, returns ./index.html file when requested directory.

rootfile string <optional>
/index.html

You can specify a file to load as a top page. (Please specify files in the published directory.)

errordocument._404 string <optional>
`${__dirname}/assets/def_pages/404.html`

Html file path to respond on the request methods other than GET.

errordocument._405 string <optional>
`${__dirname}/assets/def_pages/405.html`

Html file path to respond on not found.

View Source WebServer.js, line 7