Permalink
Browse files

HTTP search for app and server script inside lib folder

  • Loading branch information...
1 parent 5eccc4c commit 1e3fdc86145e465c0a4fe973ee98cbb52b232c0b @wdavidw committed Jun 5, 2012
Showing with 3 additions and 13 deletions.
  1. +1 −11 lib/plugins/http.coffee
  2. +2 −2 lib/plugins/router.coffee
View
@@ -47,7 +47,7 @@ app.configure(function() {
module.exports = () ->
settings = {}
cmd = () ->
- searchs = if settings.path then [settings.path] else ['server', 'app']
+ searchs = if settings.path then [settings.path] else ['app', 'server', 'lib/app', 'lib/server']
for search in searchs
search = path.resolve settings.workspace, search
if path.existsSync "#{search}"
@@ -59,16 +59,6 @@ module.exports = () ->
else if path.existsSync "#{search}.coffee"
return "coffee #{search}.coffee"
throw new Error 'Failed to discover a "server.js" or "app.js" file'
- # return "node #{path.resolve settings.workspace, settings.path}" if settings.path
- # if path.existsSync "#{settings.workspace}/server.js"
- # "node #{settings.workspace}/server"
- # else if path.existsSync "#{settings.workspace}/server.coffee"
- # "coffee #{settings.workspace}/server.coffee"
- # else if path.existsSync "#{settings.workspace}/app.js"
- # "node #{settings.workspace}/app"
- # else if path.existsSync "#{settings.workspace}/app.coffee"
- # "coffee #{settings.workspace}/app.coffee"
- # else throw new Error 'Failed to discover a "server.js" or "app.js" file'
http = null
# Register commands
route = (req, res, next) ->
@@ -78,7 +78,7 @@ match = (req, routes, i) ->
i++
null
-module.exports = router = (settings) ->
+module.exports = (settings) ->
# Validation
throw new Error 'No shell provided' if not settings.shell
shell = settings.shell
@@ -112,7 +112,7 @@ module.exports = router = (settings) ->
# Register 'quit' command
shell.cmd 'quit', 'Exit this shell', shell.quit.bind shell
# middleware
- router = (req, res, next) ->
+ (req, res, next) ->
route = null
self = this
i = 0

0 comments on commit 1e3fdc8

Please sign in to comment.