1.0.1 • Published 7 years ago

@tiaanduplessis/routify v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

About

Built on top of routington. If your looking for something fast, try find-my-way instead.

Install

$ npm install @tiaanduplessis/routify
# OR
$ yarn add @tiaanduplessis/routify

Usage

const routify = require('@tiaanduplessis/routify')
const http = require('http')

const app = routify()

app.use(({ req }, next) => {
  console.log(`Request to ${req.url}`)
  next()
})

app.route({
  url: '/',
  method: 'GET',
  handler: (ctx, next) => {
    ctx.res.end('Hai')
  }
})

app.route({
  url: '/foo',
  method: 'GET',
  handler: (ctx, next) => {
    ctx.res.end('foo!')
  }
})

http.createServer(app.lookUp).listen(8888)

Contributing

Contributions are welcome!

  1. Fork it.
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Or open up a issue.

License

Licensed under the MIT License.

1.0.1

7 years ago

1.0.0

7 years ago