Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- const HTML = `
- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Hello World</title>
- <meta name="description" content="The HTML5 Herald">
- <meta name="author" content="SitePoint">
- </head>
- <body>
- <script>
- var clicked = function() {
- var adiv = document.createElement("div");
- adiv.innerHTML = "HELLO WORLD";
- adiv.id = "asyncDiv";
- var abutton = document.createElement("button");
- abutton.innerHTML = "ASYNC BUTTON";
- abutton.type = "button";
- abutton.id = "asyncButton"
- var anOption1 = document.createElement("option");
- anOption1.innerHTML = "ONE"
- var anOption2 = document.createElement("option");
- anOption2.innerHTML = "TWO"
- setTimeout(function() {
- document.getElementById("magic").appendChild(adiv);
- document.getElementById("magic").appendChild(abutton);
- document.getElementById("asyncSelect").appendChild(anOption1);
- document.getElementById("asyncSelect").appendChild(anOption2);
- document.getElementsByTagName("title")[0].innerHTML = "NEW TITLE";
- }, 2000);
- }
- </script>
- <div id="test">test</div>
- <div id="magic"></div>
- <select id="asyncSelect">
- </select>
- <button type="button" id="async" onclick="clicked()">CLICK ME</button>
- </body>
- </html>
- `;
- const APP = require('express')();
- APP.get('/', (req, res) => {
- res.send(HTML);
- });
- setTimeout(() => {
- const server = APP.listen(5000, () => {
- console.log('---------------------------');
- console.log('TEST APPLICATION IS RUNNING');
- console.log('---------------------------');
- });
- }, 2000)
- /**
- * Close the webserver in case Antics crashes
- */
- setTimeout(function() {
- server.close();
- }, 60000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement