adonis-framework
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "adonis-framework", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Adonis framework a loosely coupled http server for adonis application, it does all the required hard work to setup a managable http server with depdendency injection in place.", | ||
@@ -19,2 +19,3 @@ "main": "index.js", | ||
"co-fs-extra": "^1.1.0", | ||
"content-type": "^1.0.1", | ||
"cookie": "^0.1.3", | ||
@@ -48,4 +49,5 @@ "dotenv": "^1.2.0", | ||
"nightwatch": "^0.7.11", | ||
"raw-body": "^2.1.2", | ||
"supertest": "^1.0.1" | ||
} | ||
} |
@@ -85,4 +85,6 @@ 'use strict' | ||
*/ | ||
Helpers.publicPath = function () { | ||
return path.join(rootPath, './public') | ||
Helpers.publicPath = function (toFile) { | ||
const configDir = './public' | ||
const incrementalPath = typeof(toFile) !== 'undefined' ? `/${configDir}/${toFile}` : configDir | ||
return Helpers._makePath(rootPath,incrementalPath) | ||
} | ||
@@ -107,4 +109,6 @@ | ||
*/ | ||
Helpers.configPath = function () { | ||
return path.join(rootPath, './config') | ||
Helpers.configPath = function (toFile) { | ||
const configDir = './config' | ||
const incrementalPath = typeof(toFile) !== 'undefined' ? `/${configDir}/${toFile}` : configDir | ||
return Helpers._makePath(rootPath,incrementalPath) | ||
} | ||
@@ -118,4 +122,6 @@ | ||
*/ | ||
Helpers.storagePath = function () { | ||
return path.join(rootPath, './storage') | ||
Helpers.storagePath = function (toFile) { | ||
const configDir = './storage' | ||
const incrementalPath = typeof(toFile) !== 'undefined' ? `/${configDir}/${toFile}` : configDir | ||
return Helpers._makePath(rootPath,incrementalPath) | ||
} | ||
@@ -129,4 +135,6 @@ | ||
*/ | ||
Helpers.resourcesPath = function () { | ||
return path.join(rootPath, './resources') | ||
Helpers.resourcesPath = function (toFile) { | ||
const configDir = './resources' | ||
const incrementalPath = typeof(toFile) !== 'undefined' ? `/${configDir}/${toFile}` : configDir | ||
return Helpers._makePath(rootPath,incrementalPath) | ||
} | ||
@@ -140,3 +148,8 @@ | ||
Helpers.viewsPath = function () { | ||
return path.join(rootPath, './resources/views') | ||
return Helpers.resourcesPath('views') | ||
} | ||
Helpers._makePath = function (base,incremental) { | ||
return path.join(base,incremental) | ||
} |
@@ -78,4 +78,3 @@ 'use strict' | ||
RequestHelpers.checkHttpContentType = function (req, types) { | ||
let type = is.is(req, types) | ||
return _.contains(types, type) | ||
return is.is(req, types) | ||
} | ||
@@ -82,0 +81,0 @@ |
@@ -15,2 +15,3 @@ 'use strict' | ||
const cookie = require('cookie') | ||
const contentType = require('content-type') | ||
@@ -71,2 +72,12 @@ /** | ||
/** | ||
* @function post | ||
* @description return request raw body | ||
* @return {*} | ||
* @public | ||
*/ | ||
Request.prototype.raw = function () { | ||
return this.rawBody | ||
} | ||
/** | ||
* @function files | ||
@@ -181,2 +192,5 @@ * @description returning uploaded files via | ||
Request.prototype.headers = function () { | ||
if(this.request.headers && this.request.headers['content-type']){ | ||
this.request.headers['content-type'] = contentType.parse(this.request.headers['content-type']).type | ||
} | ||
return this.request.headers || {} | ||
@@ -183,0 +197,0 @@ } |
@@ -10,2 +10,7 @@ 'use strict' | ||
module.exports = function (env, Route) { | ||
/** | ||
* adds route filter and makes use of route to build | ||
* dynamic routes out of the box | ||
*/ | ||
env.addFilter('route', function (val) { | ||
@@ -15,2 +20,9 @@ return Route.url(val) | ||
/** | ||
* output input as json | ||
*/ | ||
env.addFilter('json', function (val) { | ||
JSON.stringify(va) | ||
}) | ||
} |
@@ -21,3 +21,3 @@ 'use strict' | ||
const viewsPath = Helpers.viewsPath() | ||
const viewsCache = Boolean(Env.get('CACHE_VIEWS')) | ||
const viewsCache = Env.get('CACHE_VIEWS') === 'true' | ||
this.viewsEnv = new nunjucks.Environment(new ViewsLoader(viewsPath, false, !viewsCache)) | ||
@@ -24,0 +24,0 @@ viewsExtensions(this.viewsEnv) |
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
61280
2194
21
11
+ Addedcontent-type@^1.0.1
+ Addedcontent-type@1.0.5(transitive)