sme-router
sme-router
npm i sme-router
sme-router

sme-router

A lightweight router lib that implement with express route style

by SME-FE

0.12.8 (see all)License:MITTypeScript:Not Found
npm i sme-router
Readme

SME Router

A lightweight router lib that implement with express route style

Travis branch coverage download version license

Languages

Documentation

Get Start

Installation

npm i --save sme-router

Usage

Edit sme-router example

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>SME Router</title>
</head>
<body>
  <div id="app">
    <div id="router-view"></div>
  </div>
</body>
</html>

import SMERouter from 'sme-router'

const router = new SMERouter('router-view')

// route config
router.route('/index', (req, res, next) => {
  res.render(
    `hallo world`
  )
})

router.route('*', (req, res, next) => {
  res.redirect('/index')
})

Note: if your are not using webpack, your can simply import it to your html file

<script type="text/javascript" src="https://unpkg.com/sme-router"></script>

Please see the document for more details

Live demo

click me to see the demo

Running Example

1.clone the repo

npm i
npm run dev

open http://localhost:8080/

2.Test

npm run test // or => karma start

3.lint

npm run lint

Contributors

Thanks goes to these wonderful people (emoji key):


hwen

🤔 💻 🎨 📖 💡

License

MIT License

Copyright (c) 2017-present, hwen hwenleung@gmail.com

Downloads/wk

7

GitHub Stars

122

LAST COMMIT

3yrs ago

MAINTAINERS

1

CONTRIBUTORS

1

OPEN ISSUES

0

OPEN PRs

2
VersionTagPublished
0.12.8
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial
No dependencies found

Rate & Review

100
No reviews found
Be the first to rate