const http = require('http');
const fs = require('fs');
const path = require('path');
const server = http.createServer((req, res) => {
// Determine the file path based on the request URL
const filePath = path.join(__dirname, req.url === '/' ? 'index.html' : req.url);
// Read the file
fs.readFile(filePath, (err, content) => {
if (err) {
// If the file doesn't exist, return a 404 response
res.writeHead(404);
res.end('File not found!');
} else {
// Set the content type based on the file extension
const ext = path.extname(filePath);
let contentType = 'text/html';
if (ext === '.js') {
contentType = 'text/javascript';
} else if (ext === '.css') {
contentType = 'text/css';
}
// Set the response headers
res.writeHead(200, { 'Content-Type': contentType });
// Send the file content
res.end(content, 'utf-8');
}
});
});
// Start the server
server.listen(8080, () => {
console.log('Server is running on http://localhost:8080');
});
//run cli with: `/usr/lib/code-server/code-server --bind-addr 0.0.0.0:8080 --auth none`
// will run node server on 8080 and send the requests to the tunnel
Run with: $ /usr/lib/code-server/code-server --bind-addr 0.0.0.0:8080 --auth none
This will run a node server and expose localhost to 8080 where will will route requests to a tunnel that will point to public hostname: aws.stefanogramm.com
Pass through a YAML validator API ( like )
Add Elastic IP address
Experiment with Designer:
For a production environment, need to narrow down the security rules to only allow the necessary traffic. ( yaml ).