Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rehiy/webox-node
a Dynamic JS HTTP server
https://github.com/rehiy/webox-node
Last synced: about 1 month ago
JSON representation
a Dynamic JS HTTP server
- Host: GitHub
- URL: https://github.com/rehiy/webox-node
- Owner: rehiy
- Created: 2019-07-01T07:01:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-17T06:19:07.000Z (11 months ago)
- Last Synced: 2024-10-11T05:39:10.121Z (about 1 month ago)
- Language: JavaScript
- Homepage: https://www.rehiy.com/post/135/?v1
- Size: 121 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Webox-node is a Dynamic JS HTTP server
Webox-node can execute js file through node-cli, just like CGI. It can also load js file as commonjs module, just like PHP and ASP.
## install
```shell
npm i webox-node
```## simple start
```shell
npx webox
```The web server will listen on `127.0.0.1:80` and use `./webroot` as the root directory.
## publish your website
```shell
npx webox 0.0.0.0:80 public
```The web server will listen on `0.0.0.0:80` and use `./public` as the root directory.
Other users can use your internal ip to access your published site.
## execute js as cgi script
Dynamically parse `*.cgi` or '`*.cgi.js`, and then output the result to browser.
## load js as commonjs module
Dynamically parse `*.cjs` or '`*.cjs.js`, and then output the result to browser.
## normal exit with 0 or 1
Set `process.env.WEBOX_EXIT_CODE` to `1`, Even if the program exits normally, an error will be reported.
## config with file
Please set `process.env.WEBOX_CONF_FILE` to config file path.
```js
module.exports = {WEBOX_MODE: 'development',
WEBOX_HOST: '127.0.0.1',
WEBOX_PORT: 80,
WEBOX_ROOT: 'webroot',
WEBOX_INDEX: [
'index.html',
'index.htm'
],WEBOX_ERROR: {
200: '%s',
400: 'Bad Request: %s',
403: 'Forbidden : %s',
404: 'NO Found: %s',
500: 'Internal Server Error: %s',
503: 'Service Unavilable: %s'
}};
```