Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,4 @@ | ||
const _ = require('koa-route'); | ||
const koaMount = require('koa-mount'); | ||
const koaRoute = require('koa-route'); | ||
const koaStatic = require('koa-static'); | ||
@@ -7,2 +9,14 @@ module.exports = (application, inputRoute, inputController) => { | ||
/** | ||
* Routing to Public folder | ||
*/ | ||
const publicSection = koaStatic(__dirname + '/../../../public/'); | ||
application.use(koaMount('/public', publicSection)); | ||
/** | ||
* Routing to Controller | ||
*/ | ||
for (let route of inputRoute) { | ||
@@ -15,23 +29,23 @@ | ||
case 'get': | ||
application.use(_.get(route[1], controller)); | ||
application.use(koaRoute.get(route[1], controller)); | ||
break; | ||
case 'post': | ||
application.use(_.post(route[1], controller)); | ||
application.use(koaRoute.post(route[1], controller)); | ||
break; | ||
case 'put': | ||
application.use(_.put(route[1], controller)); | ||
application.use(koaRoute.put(route[1], controller)); | ||
break; | ||
case 'patch': | ||
application.use(_.patch(route[1], controller)); | ||
application.use(koaRoute.patch(route[1], controller)); | ||
break; | ||
case 'delete': | ||
application.use(_.delete(route[1], controller)); | ||
application.use(koaRoute.delete(route[1], controller)); | ||
break; | ||
default: | ||
application.use(_.get(route[1], controller)); | ||
application.use(koaRoute.get(route[1], controller)); | ||
@@ -38,0 +52,0 @@ } |
@@ -5,2 +5,3 @@ const koa = require('koa'); | ||
const application = new koa(); | ||
const applicationException = require('./configuration/exception'); | ||
const applicationRender = require('./configuration/render'); | ||
@@ -19,5 +20,10 @@ const applicationRoute = require('./configuration/route'); | ||
application.context.render = applicationRender; | ||
applicationException(application); | ||
applicationRoute(application, $.config.route, $.controller); | ||
/** | ||
* Getting Started | ||
*/ | ||
application.listen($.config.connection.PORT, $.config.connection.IP, null, () => { | ||
@@ -24,0 +30,0 @@ console.log(`Application is running on ${$.config.connection.IP}:${$.config.connection.PORT}...`); |
{ | ||
"name": "koa-winter", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Super light-weight NodeJS back-end framework built on the top of KoaJS.", | ||
@@ -15,3 +15,5 @@ "main": "index.js", | ||
"koa-bodyparser": "^3.0.0", | ||
"koa-mount": "^2.0.0", | ||
"koa-route": "^3.1.0", | ||
"koa-static": "^3.0.0", | ||
"pug": "^2.0.0-alpha6", | ||
@@ -18,0 +20,0 @@ "require-all": "^2.0.0" |
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
6081
10
124
7
+ Addedkoa-mount@^2.0.0
+ Addedkoa-static@^3.0.0
+ Addedany-promise@1.3.0(transitive)
+ Addeddebug@2.6.9(transitive)
+ Addedhttp-errors@1.6.3(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedkoa-compose@3.2.1(transitive)
+ Addedkoa-mount@2.0.0(transitive)
+ Addedkoa-send@3.3.0(transitive)
+ Addedkoa-static@3.0.0(transitive)
+ Addedms@2.0.0(transitive)
+ Addedmz@2.7.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedresolve-path@1.4.0(transitive)
+ Addedsetprototypeof@1.1.0(transitive)
+ Addedthenify@3.3.1(transitive)
+ Addedthenify-all@1.6.0(transitive)