Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lite-web-server

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lite-web-server - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1-beta.1633013080

2

example.js
var { WebServer } = require("./index.js")
var server = new WebServer({
dir: "./lib",
dir: "./",
port: 3000

@@ -5,0 +5,0 @@ })

@@ -19,4 +19,17 @@ const http = require('http')

} else {
var _dir = opt.dir ||opt.directory || "./public";
if (_dir == "/") {
var __dir = "."
} else if (_dir.endsWith("/")) {
var __dir = _dir.slice(0, -1);
} else {
var __dir = _dir
}
if (__dir.startsWith("/")) {
var dir = "."+__dir
} else {
var dir = __dir
}
var options = {
directory: opt.dir ||opt.directory || "./public",
directory: dir || "./public",
notfound: opt.notfound || `<!DOCTYPE html>\n<html>\n<head>\n<title>404 Not Found</title>\n</head>\n<body>\n<center>\n<h1>404 Not Found</h1>\n</center>\n<hr>\n<center>Node.js lite-webserver</center>\n</body>\n</html>`,

@@ -23,0 +36,0 @@ port: opt.port || 3000

{
"name": "lite-web-server",
"version": "1.0.0",
"version": "1.0.1-beta.1633013080",
"description": "creates simple web server.",
"keywords": [
"webserver",
"http"
"http",
"web-server"
],

@@ -9,0 +10,0 @@ "homepage": "https://github.com/chasyumen/lite-web-server",

@@ -5,3 +5,3 @@ # lite-web-server

This will load files from `/public` directory if it's not specified.
This will load files from `./public/` directory if it's not specified.

@@ -15,3 +15,3 @@ ## Install

This server will load files from `/public` directory.
This server will load files from `./public/` directory.

@@ -30,3 +30,3 @@ ```js

var server = new WebServer({
dir: "./public_html"
dir: "./public_html/"
})

@@ -58,3 +58,3 @@

Default: `./public`
Default: `./public/`

@@ -65,3 +65,3 @@ The directory to load the file.

new WebServer({
dir: "./public_html"
dir: "./public_html/"
})

@@ -77,3 +77,3 @@ ```

new WebServer({
notfound: "File was not found on this server."
notfound: "<center><h1>File was not found on this server.</h1></center>"
})

@@ -80,0 +80,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc