diff --git a/README.md b/README.md index 3e8c8f7..43110ea 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,26 @@

+## Table of Content + +- [Features](#features) +- [Overview](#overview) +- [Usage](#usage) + - [npm](#npm) + - [Browser](#browser) +- [Browser support](#browser-support) +- [API](#api) + - [`.add(name: string, path: string, callback: function)`](#addname-string-path-string-callback-function) + - [`.map(prefixName: string, prefixPath: string, routes: Array)`](#mapprefixname-string-prefixpath-string-routes-array) + - [`.fetchRoute(name: string[, parameters: object])`](#fetchroutename-string-parameters-object) + - [`.route: object`](#route-object) + - [`.setErrorCallback(callback: function)`](#seterrorcallbackcallback-function) + - [`.notFoundException()`](#notfoundexception) + - [`.before(path: string, callback: function)`](#beforepath-string-callback-function) + - [`.run([callback: function])`](#runcallback-function) +- [License](#license) + + ## Features - Dynamic routing & URL generator @@ -80,23 +100,30 @@ leafeon.map('docs_', '/docs', [ ]); ~~~ -## Installation (npm) +## Usage + +#### npm + +Install the package : ~~~shell -npm install leafeon +npm i leafeon --save ~~~ -#### Usage - ```js const leafeon = require('leafeon').Router(); +// or using ES6 +// import * as leafeon from 'leafeon'; +// const router = leafeon.Router(); -leafeon.add('home', '/', function () { +leafeon.add('home', '/', () => { document.write('hello world'); -}).run(); +}) + +leafeon.run(); ``` -## Browser usage +### Browser 1. Include leafeon.js in **** or at the end of the ****