Last active
August 29, 2015 13:57
-
-
Save fiveisprime/9772211 to your computer and use it in GitHub Desktop.
Koa Scaffold
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var koa = require('koa'); | |
| var path = require('path'); | |
| var route = require('koa-route'); | |
| var render = require('koa-swig'); | |
| var app = koa(); | |
| render(app, { | |
| root: path.join(__dirname, 'views'), | |
| autoescape: true, | |
| cache: 'memory', | |
| ext: 'html' | |
| }); | |
| app.use(require('koa-logger')()); | |
| app.use(require('koa-favi')()); | |
| app.use(require('koa-body')()); | |
| app.use(require('koa-static')(path.join(__dirname, 'public'))); | |
| app.use(route.get('/', function *(){ | |
| yield this.render('index'); | |
| })); | |
| app.listen(process.env.PORT || 3000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "koa-scaffold", | |
| "version": "0.0.0", | |
| "description": "Scaffold application using Koa.", | |
| "main": "app.js", | |
| "scripts": { | |
| "start": "node --harmony app" | |
| }, | |
| "engines": { | |
| "node": "0.11.x" | |
| }, | |
| "author": "Matt Hernandez <[email protected]>", | |
| "license": "ISC", | |
| "dependencies": { | |
| "koa": "^0.5.2", | |
| "koa-route": "^1.1.1", | |
| "koa-logger": "^1.2.0", | |
| "koa-swig": "^0.3.0", | |
| "koa-static": "^1.4.3", | |
| "koa-favi": "^0.1.0", | |
| "koa-body": "0.0.4" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment