Skip to content

cheft/minrouter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

339b6b3 · Jul 21, 2017

History

39 Commits
Jul 21, 2017
Jul 20, 2017
Jun 23, 2017
Jul 21, 2017
Jul 21, 2017
Jun 23, 2017
Jul 21, 2017
Jul 21, 2017
Jul 21, 2017
Jun 22, 2017
Jul 21, 2017
Jul 21, 2017

Repository files navigation

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

About

a micro middleware router for isomorphic javaScript web apps

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published