Skip to content

Instantly share code, notes, and snippets.

@reaktivo
Created May 24, 2017 12:57
Show Gist options
  • Save reaktivo/38d1e35dd09c5243fa10956da90c67f1 to your computer and use it in GitHub Desktop.
Save reaktivo/38d1e35dd09c5243fa10956da90c67f1 to your computer and use it in GitHub Desktop.
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