2 Star 0 Fork 0

mirrors_cocos-creator/deprecated-editor-ui-angular

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
server.js 1.34 KB
一键复制 编辑 原始数据 按行查看 历史
Johnny Wu 提交于 2014-05-26 19:25 . add basic ui
// init express
var express = require('express');
var app = express();
// create an error with .status. we
// can then use the property in our
// custom error handler (Connect repects this prop as well)
function error(status, msg) {
var err = new Error(msg);
err.status = status;
return err;
}
// routes
app.get('/', function(req, res){
res.sendfile('test/index.html');
});
// serves all the static files
app.get(/^(.+)$/, function(req, res){
// console.log('static file request : ' + req.params);
res.sendfile( __dirname + req.params[0]);
});
// middleware with an arity of 4 are considered
// error handling middleware. When you next(err)
// it will be passed through the defined middleware
// in order, but ONLY those with an arity of 4, ignoring
// regular middleware.
app.use(function(err, req, res, next){
// whatever you want here, feel free to populate
// properties on `err` to treat it differently in here.
res.send(err.status || 500, { error: err.message });
});
// our custom JSON 404 middleware. Since it's placed last
// it will be the last middleware called, if all others
// invoke next() and do not respond.
app.use(function(req, res){
res.send(404, { error: "404 Error." });
});
// start the server
var server = app.listen(8081, function() {
console.log('Listening on port %d', server.address().port);
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors_cocos-creator/deprecated-editor-ui-angular.git
[email protected]:mirrors_cocos-creator/deprecated-editor-ui-angular.git
mirrors_cocos-creator
deprecated-editor-ui-angular
deprecated-editor-ui-angular
master

搜索帮助