1.0.0-beta.4 • Published 7 years ago

minrouter v1.0.0-beta.4

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

minrouter

a micro middleware router that can be used in both client-side (e.g. dot.js, vue, react, preact) and server-side applications (e.g. Node.js/Express, Koa)

features

  • support koa
  • support express
  • support browser pushState & replaceState
  • middleware router, API like express

preview

preview

install

npm install minrouter

build

npm run build

run demo

# build the web code
npm run demo

# http://localhost:3000
npm run express

or

# http://localhost:4000
npm run koa

or

# http://localhost:4000
npm run preact

usage

see demo directory code

api

  • Router.get(path, fn)
  • Router.addResMethod(name, fn)
  • Router.go(path, isReplace) only browser
  • Router.back() only browser
  • Router.proxyLinks(nodes) only browser
  • req.query & req.params, this.ctx, this.ctx.res

see src/minrouter.js

1.0.0-beta.4

7 years ago

1.0.0-beta.3

7 years ago

1.0.0-beta.2

7 years ago

1.0.0-beta.1

7 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago