summaryrefslogtreecommitdiffhomepage
path: root/test/node/promise_handler/app.js
blob: 7bcb1ae96c4e37572765187d78eb76b09ccbf259 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

var fs = require('fs');

require('http').createServer(function (req, res) {
    res.end();

    if (req.headers['x-write-call']) {
        res.writeHead(200, {'Content-Type': 'text/plain'}).write('blah');
    }

    Promise.resolve().then(() => {
        req.on('data', (data) => {
            fs.appendFile(data.toString(), '', function() {});
        });
    });
}).listen(8080);