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. |
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> |
||
directory |
string |
<optional> |
./public/ | The directory to load the file. |
acceptonlyget |
boolean |
<optional> |
true | Only accepts get request. |
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. |
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.) |
port |
Number |
<optional> |
3000 | Port to host the page. |