mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
14 lines
362 B
TypeScript
14 lines
362 B
TypeScript
import * as http from 'http';
|
|
import onHeaders = require('on-headers');
|
|
|
|
http.createServer((req, res) => {
|
|
onHeaders(res, function addPoweredBy() {
|
|
if (!this.getHeader('X-Powered-By')) {
|
|
this.setHeader('X-Powered-By', 'Node.js');
|
|
}
|
|
});
|
|
|
|
res.setHeader('Content-Type', 'text/plain');
|
|
res.end('hello!');
|
|
}).listen(3000);
|