basic-node-server
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -28,2 +28,8 @@ #!/usr/bin/env node | ||
// check if its a get request | ||
if (req.method !== 'GET') { | ||
res.statusCode = 405; | ||
res.end('Method not allowed'); | ||
} | ||
// remove get query string | ||
@@ -30,0 +36,0 @@ filePath = filePath.split('?')[0]; |
{ | ||
"name": "basic-node-server", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Basic node server for everyone.", | ||
@@ -5,0 +5,0 @@ "main": "bns.js", |
@@ -5,29 +5,25 @@ # basic-node-server | ||
Basic node server simply hosts and serves files from the current project directory through HTTP. | ||
If no path is given, it will serve the index.html file. | ||
If no path is given, it will serve the index.html file in the root directory. | ||
## How to use | ||
## Installation | ||
``` | ||
node bns [port] | ||
npm install basic-node-server | ||
``` | ||
The [port] argument is optional. If no port is given, it will default to 3000. | ||
## Usage | ||
For example, if you want to serve the current directory on port 8080, you would run: | ||
Then, you can run it from your project directory: | ||
``` | ||
node bns 8080 | ||
npx bns [port] | ||
``` | ||
## NPM | ||
This package is also available on NPM. To install it, run: | ||
The [port] argument is optional. If no port is given, it will default to 3000. | ||
``` | ||
npm install basic-node-server | ||
For example, if you want to serve the current directory on port 8080, you would run: | ||
``` | ||
Then, you can run it from your project directory: | ||
``` | ||
node node_modules/basic-node-server/bns [port] | ||
node bns 8080 | ||
``` |
47516
1266
28