8.6
a lightweight simple webserver made with deno js
Repository
Current version released
2 years ago
Dependencies
install deno
start
webserver.js
and import the module
create a file import {O_webserver} from "https://deno.land/x/o_webserver@[n_version]/O_webserver.module.js"
//windows
// var s_folder_separator = "\"
//linux
var s_folder_separator = "/"
var s_path_o_webserver_root = import.meta.url
.split("file://")
.pop()
.split(s_folder_separator)
.slice(0,-1)
.join(s_folder_separator)
var o_webserver = new O_webserver(
s_path_o_webserver_root
);
o_webserver.f_serve_all();
mkdir localhost
create a folder and create a testfile for the domain name localhost
mkdir localhost
create the default behaviour of a file explorer
wget https://deno.land/x/o_webserver@[n_version]/f_http_request_handler.module.js.example > ./localhost/f_http_request_handler.module.js"
create a testfile wich acts as testcontent
echo "server running" > ./localhost/test.txt
visit the page
https://localhost/test.txt
start the webserver in background
install pm2
sudo apt install pm2
start in background
pm2 start webserver.js --interpreter="deno" --interpreter-args="run --allow-net"
show running
pm2 status
… thats it