Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

koa-winter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa-winter - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

configuration/exception.js

28

configuration/route.js

@@ -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"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc