Created
April 6, 2016 00:08
-
-
Save KidkArolis/7241eaa6e7574b55ac1c73b5e2095ed6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
'use strict' | |
let express = require('express') | |
let axios = require('axios') | |
let server | |
function once (cb) { | |
let app = express() | |
app.get('/foo', (req, res, next) => { | |
res.send('ok') | |
cb() | |
}) | |
return app | |
} | |
let app = once(function () { | |
server.close(function () { | |
console.log('Does this get called?') | |
}) | |
}) | |
server = app.listen(28090, function () { | |
axios.get('http://localhost:28090/foo').then(function (response) { | |
console.log('GOT', response.data) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment