2 Star 0 Fork 0

mirrors_cocos-creator/deprecated-atlas-editor-polymer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
server.js 906 Bytes
一键复制 编辑 原始数据 按行查看 历史
Johnny Wu 提交于 2014-08-04 15:18 +08:00 . simple server.js
// init express
var express = require('express');
var app = express();
// create an error with .status.
function error(status, msg) {
var err = new Error(msg);
err.status = status;
return err;
}
// routes
app.get('/', function(req, res){
res.sendfile('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]);
});
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.status(err.status || 500).send({ error: err.message });
});
app.use(function(req, res){
res.status(404).send({ 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-atlas-editor-polymer.git
[email protected]:mirrors_cocos-creator/deprecated-atlas-editor-polymer.git
mirrors_cocos-creator
deprecated-atlas-editor-polymer
deprecated-atlas-editor-polymer
master

搜索帮助