Serve files without listening to request end event
This commit is contained in:
1 parent
03e57616f7
commit
5934178d91
1 file changed
-2
@@ -28,7 +28,6 @@ else
|
|||||||
server = http.createServer((request, response) ->
|
server = http.createServer((request, response) ->
|
||||||
urlParts = url.parse(request.url, true)
|
urlParts = url.parse(request.url, true)
|
||||||
if request.method == 'GET'
|
if request.method == 'GET'
|
||||||
request.addListener('end', () ->
|
|
||||||
gs = new mongodb.GridStore(db, urlParts.pathname.substring(1), 'r', {})
|
gs = new mongodb.GridStore(db, urlParts.pathname.substring(1), 'r', {})
|
||||||
gs.open((err, gs) ->
|
gs.open((err, gs) ->
|
||||||
if err
|
if err
|
||||||
@@ -39,7 +38,6 @@ else
|
|||||||
response.writeHead(200)
|
response.writeHead(200)
|
||||||
stream.pipe(response)
|
stream.pipe(response)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
else
|
else
|
||||||
response.writeHead(405, {'Allow': 'GET'})
|
response.writeHead(405, {'Allow': 'GET'})
|
||||||
response.end('405 Method Not Allowed')
|
response.end('405 Method Not Allowed')
|
||||||
|
|||||||
Reference in new issue
Block a user