create a webdav server code example
Example 1: creating a web server in js
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
Example 2: how to setup a web server
sudo apt-get update
sudo apt-get install apache2
sudo service apache2 start
sudo service apache2 stop
hostname -I
ifconfig
ip addr