Comparing version 0.1.0-beta-56 to 0.1.0-beta-57
@@ -8,2 +8,3 @@ "use strict"; | ||
ControllerInterface = di.load('interface/controller'), | ||
BodyParser = di.load('core/bodyParser'), | ||
view = component.get('core/view'), | ||
@@ -28,3 +29,3 @@ Controller; | ||
* @method Controller#setStatusCode | ||
* | ||
* @param code {number} | ||
* @description | ||
@@ -51,3 +52,3 @@ * Set status code | ||
* @method Controller#hasHeader | ||
* | ||
* @param key {string} | ||
* @description | ||
@@ -74,3 +75,3 @@ * has response header | ||
* @method Controller#getRequestHeader | ||
* | ||
* @param key {string} | ||
* @description | ||
@@ -152,5 +153,6 @@ * Get request header | ||
* @method Controller#onEnd | ||
* | ||
* @param route {string} | ||
* @param params {object} | ||
* @description | ||
* On end | ||
* Create an url depends on route an parameters to router service | ||
*/ | ||
@@ -164,5 +166,5 @@ createUrl: function Controller_createUrl(route, params) { | ||
* @method Controller#onEnd | ||
* | ||
* @param callback {function} | ||
* @description | ||
* On end | ||
* On end exec callback | ||
*/ | ||
@@ -176,3 +178,4 @@ onEnd: function Controller_onEnd(callback) { | ||
* @method Controller#addHeader | ||
* | ||
* @param key {string} | ||
* @param value {string} | ||
* @description | ||
@@ -188,3 +191,4 @@ * Add header to request | ||
* @method Controller#forward | ||
* | ||
* @param route {string} | ||
* @param params {object} | ||
* @description | ||
@@ -200,8 +204,8 @@ * Redirect to some url | ||
* @method Controller#forwardUrl | ||
* | ||
* @param url {string} | ||
* @description | ||
* Redirect to some url | ||
*/ | ||
forwardUrl: function Controller_forwardUrl(route, params) { | ||
return this.__requestApi__.forwardUrl(route, params); | ||
forwardUrl: function Controller_forwardUrl(url) { | ||
return this.__requestApi__.forwardUrl(url); | ||
}, | ||
@@ -212,3 +216,4 @@ /** | ||
* @method Controller#redirect | ||
* | ||
* @param url {string} | ||
* @param isTemp {boolean} | ||
* @description | ||
@@ -224,3 +229,4 @@ * Redirect to some url | ||
* @method Controller#renderFile | ||
* | ||
* @param pathName {string} | ||
* @param locals {object} | ||
* @description | ||
@@ -236,3 +242,5 @@ * Render file | ||
* @method Controller#render | ||
* | ||
* @param source {string} | ||
* @param locals {object} | ||
* @param escape {boolean} | ||
* @description | ||
@@ -284,3 +292,3 @@ * Render view | ||
* @method Controller#getSession | ||
* | ||
* @param key {string} | ||
* @description | ||
@@ -290,3 +298,3 @@ * Get session key | ||
*/ | ||
getSession: function (key) { | ||
getSession: function Controller_getSession(key) { | ||
var session = component.get('storage/session'), | ||
@@ -305,3 +313,4 @@ session_id = this.getCookie(session.getCookieKey()); | ||
* @method Controller#setSession key value | ||
* | ||
* @param key {string} | ||
* @param value {object|mixed} | ||
* @description | ||
@@ -311,3 +320,3 @@ * Set session | ||
*/ | ||
setSession: function (key, value) { | ||
setSession: function Controller_setSession(key, value) { | ||
var session = component.get('storage/session'), | ||
@@ -327,3 +336,3 @@ session_id = this.getCookie(session.getCookieKey()); | ||
* @method Controller#removeSession | ||
* | ||
* @param key {string} | ||
* @description | ||
@@ -333,3 +342,3 @@ * Remove session key | ||
*/ | ||
removeSession: function (key) { | ||
removeSession: function Controller_removeSession(key) { | ||
var session = component.get('storage/session'), | ||
@@ -348,7 +357,12 @@ session_id = this.getCookie(session.getCookieKey()); | ||
* @method Controller#setCookie | ||
* | ||
* @param key {string} | ||
* @param value {string} | ||
* @param expires {string|object|number} | ||
* @param path {string} | ||
* @param domain {string} | ||
* @param isHttpOnly {boolean} | ||
* @description | ||
* Decode string | ||
* Set cookie header | ||
*/ | ||
setCookie: function (key, value, expires, path, domain, isHttpOnly) { | ||
setCookie: function Controller_setCookie(key, value, expires, path, domain, isHttpOnly) { | ||
var cookie, date; | ||
@@ -401,2 +415,3 @@ | ||
* Parse cookies | ||
* @return {object} | ||
*/ | ||
@@ -421,7 +436,8 @@ getCookies: function Controller_getCookies() { | ||
* @method Controller#getCookie | ||
* | ||
* @param key {string} | ||
* @description | ||
* Get all cookies | ||
* @return {null|string} | ||
*/ | ||
getCookie: function (key) { | ||
getCookie: function Controller_getCookie(key) { | ||
var cookies = this.getCookies(); | ||
@@ -436,5 +452,22 @@ if (cookies.hasOwnProperty(key)) { | ||
* @author Igor Ivanovic | ||
* @method Controller#hasAction | ||
* @method Controller#getParsedBody | ||
* | ||
* @description | ||
* Parse body and return parsed object | ||
* @return {object} | ||
*/ | ||
getParsedBody: function Controller_getParsedBody() { | ||
var parser = new BodyParser( | ||
this.getRequestHeader('content-type'), | ||
this.getRequestBody() | ||
); | ||
parser.parse(); | ||
return parser.getBody(); | ||
}, | ||
/** | ||
* @since 0.0.1 | ||
* @author Igor Ivanovic | ||
* @method Controller#hasAction | ||
* @param name {string} | ||
* @description | ||
* Check if controller have action | ||
@@ -450,3 +483,3 @@ * @return {boolean} | ||
* @method Controller#getAction | ||
* | ||
* @param name {string} | ||
* @description | ||
@@ -453,0 +486,0 @@ * Get controller action |
@@ -595,3 +595,7 @@ "use strict"; | ||
} catch (e) { | ||
reject(new error.HttpError(500, arguments, "Error on executing action", e)); | ||
if (e instanceof error.HttpError) { | ||
reject(e); | ||
} else { | ||
reject(new error.HttpError(500, {}, "Error on executing action", e)); | ||
} | ||
} | ||
@@ -612,3 +616,7 @@ }); | ||
} catch (e) { | ||
throw new error.HttpError(500, arguments, "Error on executing action", e); | ||
if (e instanceof error.HttpError) { | ||
throw e; | ||
} else { | ||
throw new error.HttpError(500, {}, "Error on executing action", e); | ||
} | ||
} | ||
@@ -615,0 +623,0 @@ } |
@@ -19,2 +19,3 @@ { | ||
"core/view": "@{framework}/core/view", | ||
"core/bodyParser": "@{framework}/core/bodyParser", | ||
@@ -21,0 +22,0 @@ "db/mongo": "@{framework}/db/mongo", |
@@ -5,3 +5,3 @@ { | ||
"description": "Powerful lightweight mvc framework for nodejs", | ||
"version": "0.1.0-beta-56", | ||
"version": "0.1.0-beta-57", | ||
"dependencies" : { | ||
@@ -8,0 +8,0 @@ "mongoose": "3.8.x", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147606
36
4690