Skip to content
This repository has been archived by the owner on May 30, 2020. It is now read-only.

Commit

Permalink
Docs: ToC & npm usage for ES6
Browse files Browse the repository at this point in the history
  • Loading branch information
sundowndev authored May 15, 2019
1 parent 331dfda commit ff5657d
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,26 @@
<img src="https://i.imgur.com/DKcKGvP.png" alt="">
</p>

## 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
Expand Down Expand Up @@ -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 **<head>** or at the end of the **<body>**

Expand Down

0 comments on commit ff5657d

Please sign in to comment.