//express.js var Application = require("./application"); function createApplication(){ var app = new Application(); return app; } exports = module.exports = createApplication; //index.js/* 这里是我们的业务模块 */ var express = require("./app"); var app = new express(); app.use("/",function(req,res){ res.writeHead(200,{"Content-type":"text/plain"});//mime.json文件 res.end("Hello my homepage~!"); }); app.use("/dnedu",function(req,res){ res.writeHead(200,{"Content-type":"text/plain"});//mime.json文件 res.end("Hello,welcome to dnedu~!"); }); app.listen(3000); //app.js//var express = require("./lib/express"); exports = module.exports = require("./lib/express");//可以不用变量保存直接等于require引入的对象
express源码(3)
最新推荐文章于 2024-05-01 06:51:56 发布