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

# This is just an apache server...

# Do a quick update...
sudo apt-get update

# Install apache2...
sudo apt-get install apache2

# Start it...
sudo service apache2 start

# Stop it if you are not using
sudo service apache2 stop

# To access it after starting.. find your ip address like this...
hostname -I
# or
ifconfig
# or
ip addr

# Now type your ip address in a browser you use. E.g: http://[IP Add.]