Skip to content

Commit

Permalink
node re eval bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jindw committed May 3, 2014
1 parent e43012e commit 8e3ccbc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -57,5 +57,6 @@ exports.parseCode = parseCode;
exports.parseMarkdown = parseMarkdown;
exports.seekMarkdown = seekMarkdown;
exports.start = function(root){
console.log('## start!')
require('./server').start(root);
};
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -4,7 +4,7 @@
"author": "bae",
"description": "The first bae nodejs app!",
"scripts": {
"start": "node server.js"
"start": "node start.js"
},
"main": "./index.js",
"dependencies": {
Expand Down
12 changes: 9 additions & 3 deletions server.js
Expand Up @@ -2,9 +2,15 @@ var LiteEngine = require('lite').LiteEngine;
var path = require('path');
var fs = require('fs');
var http = require('http');
var engine;
function start(root){
if(engine != null){//node 一个重复执行的奇怪问题
return ;
}
//console.log('@@@'+new Error().stack)
root = path.resolve(root || './');
var engine = new LiteEngine(root);
engine = new LiteEngine(root);
var port = process.env.APP_PORT || 18080;
require('lite/test/file-server').createServer(function (req, response,root) {
var url = req.url;
var param = {};
Expand All @@ -31,7 +37,7 @@ function start(root){
return true;
}

},root).listen(process.env.APP_PORT || 18080);
console.log('lite test server is started: http://127.0.0.1:'+(process.env.APP_PORT || 18080));
},root).listen(port);
console.log('lite test server is started: http://localhost:'+(port));
}
exports.start = start;
1 change: 0 additions & 1 deletion start.js

This file was deleted.

0 comments on commit 8e3ccbc

Please sign in to comment.