nodejs-日常练习记录-使用express搭建static服务器.

时间:2022-05-23 02:50:28
cd C:\wxg\test\node_demo\myapp
nvmw use 0.12.1
node static.js

nodejs-日常练习记录-使用express搭建static服务器.

var express = require('express');

var app = express();

var subApp = express();
subApp.get('/', function(req, res, next){
res.send('Hello, Welcome!');
console.log(111);
next();
}); app.use(subApp); app.use('/easyui',express.static('./web/public/easyui/static'));
app.use('/easyui_lib',express.static('./web/libs/jquery-easyui')); app.listen(3000, function(req, res){
console.log('http://localhost:3000');
console.log('app is running at port 3000');
});

访问 http://localhost:3000/easyui/hello.html 能够看到使用easyui制作的helloworld界面

nodejs-日常练习记录-使用express搭建static服务器.