Created
May 24, 2017 12:57
-
-
Save reaktivo/38d1e35dd09c5243fa10956da90c67f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express');; | |
const app = express(); | |
app.get('/first.js', (req, res) => { | |
setTimeout(() => { | |
res.send('alert("First script")'); | |
}, 350); | |
}) | |
app.get('/second.js', (req, res) => { | |
setTimeout(() => { | |
res.send('alert("Second script")'); | |
}, 200); | |
}) | |
app.get('/', (req, res) => { | |
res.send(` | |
<!DOCTYPE html> | |
<html dir="ltr" lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<script> | |
var first = document.createElement('script'); | |
var second = document.createElement('script'); | |
first.src = '/first.js'; | |
second.src = '/second.js'; | |
document.head.appendChild(first); | |
document.head.appendChild(second); | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> | |
`) | |
}) | |
app.listen(9999, () => { | |
console.log("listening"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment