html file which used as content is following.var http = require("http"); var url = require("url"); var fs = require('fs'); var jsdom = require('jsdom'); var path = require('path'); var jsdomHome = path.dirname(require.resolve('jsdom')); var domToHtml = require(path.resolve(jsdomHome, 'jsdom/browser/domtohtml')); var jquery = 'http://code.jquery.com/jquery-1.10.1.min.js'; function start() { function onRequest(request, response) { var pathname = url.parse(request.url).pathname; console.log("Request for " + pathname + " received."); var content = fs.readFileSync("./index.html", 'utf-8') var document = jsdom.jsdom(content); var window = document.createWindow(); jsdom.jQueryify(window, jquery, function(window, $) { $('body').append('<div>More Hello world!!</div>'); response.writeHead(200, {"Contet-Type": "text/plain"}); response.write(domToHtml.domToHtml(document, true)); response.end(); }); } http.createServer(onRequest).listen(8080); console.log("Server has started."); } start();
The result is following.<!DOCTYPE html> <html lang="ja"> <head> <meta charset="utf-8"> <title>EmberJS Test</title> </head> <body> <div>Hello, world!</div> </body> </html>
Hello, world! More Hello world!!
Streamlit is a …
I bought M5Stac…