Constructor
# new WebServer(optionsopt) → {WebServer}
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
options |
WebServerOptions |
<optional> |
WebServer Options. |
Examples
const { WebServer } = require("lite-web-server");
var server = new WebServer();
server.start();
const { WebServer } = require("lite-web-server");
var server = new WebServer({
port: 3000, //port
directory: "./public", //directory to publish
serveindex: false, //disable serve-Index feature.
acceptonlyget: true, //returns 405 to the request with method other than GET.
useindexhtml: true, //returns /index.html on that directory when the directory was requested.
rootfile: "/index.html", //the file that is used as the home page.
errordocument: {
_404: `./public/404.html`, //File path to use as a 404 error page.
_405: `./public/405.html`, //File path to use as a 405 error page.
}
});