-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separated the function export from bin.
- Loading branch information
Showing
4 changed files
with
27 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
#!/usr/bin/env node | ||
/* global require, process*/ | ||
var args = process.argv.slice(2); | ||
var express = require('express'); | ||
var app = express(); | ||
var dir = process.cwd().toString(); | ||
var port = args.length > 0 ? args[0] : 80; | ||
app.use(express.static(process.cwd().toString())); | ||
app.listen(port); | ||
console.log('Server started on '+ port); | ||
var starNode = require('../main.js'); | ||
starNode.start(dir, port); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* an empty file */ | ||
(function(){ | ||
var server = undefined; | ||
|
||
function startServer(rootDir, port){ | ||
var express = require('express'); | ||
server = express(); | ||
server.use(express.static(rootDir)); | ||
server.listen(port, function(){ | ||
console.log('Server started on '+ port); | ||
}); | ||
} | ||
|
||
function stopServer(){ | ||
if(server){ | ||
server.close(); | ||
} | ||
} | ||
|
||
exports.start = startServer; | ||
exports.stop = stopServer; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters