Skip to content
Browse files

New routes (removed the 'doc' prefix)

  • Loading branch information...
1 parent 38788f7 commit a7e312880ed72629c961061c62826246600df3fb @dmfrancisco committed Jul 12, 2011
Showing with 11 additions and 4 deletions.
  1. +0 −1 public/index.html
  2. +11 −3 web.coffee
View
1 public/index.html
@@ -1 +0,0 @@
-Hello!
View
14 web.coffee
@@ -15,14 +15,22 @@ server = connect(
connect.router (app) ->
editor = require './editor'
- app.get '/doc/?', (req, res, next) ->
+ app.get '/?', (req, res, next) ->
uid = crypto.createHash('md5').update("" + (new Date()).getTime()).digest("hex").toString().substring(0, 9)
- res.writeHead 301, {location: "/doc/#{uid}"}
+ res.writeHead 301, {location: "/#{uid}"}
res.end()
- app.get '/doc/:docName', (req, res, next) ->
+ app.get '/:docName', (req, res, next) ->
docName = req.params.docName
editor docName, server.model, res, next
+
+ # The 404 route
+ # app.get '/*', (req, res, next) ->
+ # fs.readFile './public/404.html', encoding = 'utf8', (err, data) ->
+ # console.log(data)
+ # res.writeHead 200, {'Content-Type': 'text/html'}
+ # res.write data
+ # res.end()
)
# if process.env.REDISTOGO_URL

0 comments on commit a7e3128

Please sign in to comment.
Something went wrong with that request. Please try again.