Browse files

Move the folder

  • Loading branch information...
1 parent 83f24e6 commit bebed9570a2e5e435c9e66a6718edb57f5996e78 @JacksonTian committed Jul 15, 2011
View
6 app.js
@@ -1,7 +1,7 @@
-PORT = 8000;
+var PORT = 8000;
var http = require('http'),
- mvc = require('./mvc'),
- Exception = require('./libraries/exception').Exception;
+ mvc = require('./core/mvc'),
+ Exception = require('./core/libraries/exception').Exception;
var framework = mvc.bootMVC();
View
0 config.js → core/config.js
File renamed without changes.
View
3 context.js → core/context.js
@@ -16,8 +16,7 @@ Context.prototype = {
response = context.response;
var ext = ".html";
- var filePath = path.join(__dirname, "/views/", view + ext);
-
+ var filePath = path.join(__dirname, "../views/", view + ext);
path.exists(filePath, function(exists) {
if(!exists) {
framework.handler404(request, response, "This file doesn't exist.");
View
0 libraries/contentTypes.js → core/libraries/contentTypes.js
File renamed without changes.
View
0 libraries/cookie.js → core/libraries/cookie.js
File renamed without changes.
View
0 libraries/exception.js → core/libraries/exception.js
File renamed without changes.
View
0 libraries/session.js → core/libraries/session.js
File renamed without changes.
View
4 mvc.js → core/mvc.js
@@ -55,7 +55,7 @@ MVC.prototype.dispatch = function (request, response) {
//console.log(request.cookie.map);
request.session = sessionStorage.getSession(request);
//console.log(request.session);
- var controller = require('./controllers/' + routeInfo.controller).controller;
+ var controller = require('../controllers/' + routeInfo.controller).controller;
if (controller[routeInfo.method] && controller[routeInfo.method][routeInfo.action]) {
var context = new Context(request, response, this);
controller[routeInfo.method][routeInfo.action].apply(context, routeInfo.args);
@@ -72,7 +72,7 @@ MVC.prototype.dispatch = function (request, response) {
MVC.prototype.dispatchStatic = function (request, response, filePath) {
var framework = this;
if(!filePath){
- filePath = path.join(__dirname, url.parse(request.url).pathname);
+ filePath = path.join(__dirname, "..", url.parse(request.url).pathname);
}
path.exists(filePath, function(exists) {
if(!exists) {
View
7 route.js → core/route.js
@@ -1,4 +1,5 @@
-var parse = require('url').parse;
+var parse = require('url').parse,
+ path = require('path');
var Router = function () {
this.routes = {
@@ -35,10 +36,10 @@ Router.prototype = {
filter: function (info) {
if (info.controller === "favicon.ico") {
info.controller = "statics"
- info.filePath = "./statics/" + "favicon.ico";
+ info.filePath = path.join(__dirname, "../statics/favicon.ico");
}
return info;
}
};
-exports.Router = Router;
+exports.Router = Router;
View
0 viewEngine.js → core/viewEngine.js
File renamed without changes.

0 comments on commit bebed95

Please sign in to comment.