mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
18 lines
404 B
JavaScript
18 lines
404 B
JavaScript
var s = node.http.createServer(function (req, res) {
|
|
var body = "exports.A = function() { return 'A';}";
|
|
res.sendHeader(200, [
|
|
["Content-Length", body.length],
|
|
["Content-Type", "text/plain"]
|
|
]);
|
|
res.sendBody(body);
|
|
res.finish();
|
|
});
|
|
s.listen(8000);
|
|
|
|
include("mjsunit.js");
|
|
var a = require("http://localhost:8000/")
|
|
|
|
assertInstanceof(a.A, Function);
|
|
assertEquals("A", a.A());
|
|
s.close();
|