Skip to content

Commit

Permalink
esqueleto simpleAuth
Browse files Browse the repository at this point in the history
  • Loading branch information
werelax committed Apr 25, 2014
1 parent 9cff344 commit 0e8512b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
15 changes: 15 additions & 0 deletions ejercicios/blog/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ function resources(app, name, controller) {
resources(app, "posts", postsController);

app.use(express.static(__dirname + "/public"));
app.get("/pete", function() {
throw new Error("Oh, no!");
});

/* Errors */

app.use(function(req, res, next) {
res.send(404, "Pagina no encontrada");
});

app.use(function(err, req, res, next) {
console.log(req.url, Date.now(), err.message);
res.send(500, "Ocurrio algun error..");
});

app.listen(3000);

/* Populate */
Expand Down
6 changes: 0 additions & 6 deletions ejercicios/flashMessages.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ app.use(function(req, res, next) {
next();
});


app.get("/test", function(req, res) {
var random = Math.random();
if (random > 0.5) {
Expand All @@ -36,9 +35,4 @@ app.get("/test2", function(req, res) {
res.send(200, req.flash.message());
});

app.use(function(err, req, res, next) {
console.log("Error!");
res.send("error!");
});

app.listen(3000);

0 comments on commit 0e8512b

Please sign in to comment.