Skip to content

Instantly share code, notes, and snippets.

View fatshotty's full-sized avatar

fatshotty fatshotty

View GitHub Profile
@fatshotty
fatshotty / app.js
Created September 6, 2012 07:57
Implement the response.redirect method for AppJS
var Response = require("appjs/lib/router/Response");
var Request = require("appjs/lib/router/Request");
Response.prototype.redirect = function(path){
this.req.url = path;
req = new Request({url: path, headers: this.req.headers, method: "get", post: this.req.post, files: this.req.files});
Server.handle.apply(Server, [req, this, this.req.next]);
};
// Use this Getter method for including 'session management'
@fatshotty
fatshotty / application.js
Created August 6, 2012 00:21
Use Express with AppJS
var Express = require("express"); // express 2.5.9
var AppJS = require("appjs");
var Utils = require("util");
// Create out Express server application
var App = Express.createServer();
// Set our Express server application settings
App.use(Express.bodyParser());
App.register("jade", require("jade").express);
@fatshotty
fatshotty / application.coffee
Created May 4, 2012 14:12
Express namespace workaround in order to use regexp in routing ( this is just an example. maybe it could help )
Express = require("express")
require "./express_namespace"
App = Express.createServer()
App.get "/start", (req, res, next) ->
res.end "this is the start end point without namespace"