0.4.0 • Published 7 years ago

punky v0.4.0

Weekly downloads
4
License
BSD-3-Clause
Repository
github
Last release
7 years ago

punky

Build Status js-standard-style

Bootstrap your APIs taking advantage of the best community modules

Quickstart

  • Create app.js:
'use strict'

const Punky = require('punky')
const Router = require('express').Router

const punky = new Punky(/* options */)

if (punky.app) {
  const router = Router()
  const body = new Buffer('Hello World')
  const message = body.toString('utf8')

  router.get('/', (req, res, next) => {
    req.log.info(message)
    req.metrics.increment('home')
    res.set('Content-Type', 'text/html')
    res.send(body)
  })

  punky.app.use(router)
}

punky.run().catch(punky.logger.error)
  • Run:
$ node app.js