# beautiful-router

> A fast and dynamic router for Server-Side-Rendering applications.

Latest version **1.0.4** (published 2023-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install beautiful-router
pnpm add beautiful-router
yarn add beautiful-router
bun add beautiful-router
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2023-09-01 |
| First published | 2020-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 40 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 0 |
| Maintainers | yannickdebree |
| Keywords | router |

## Links

- npm: https://www.npmjs.com/package/beautiful-router
- Repository: https://github.com/yannickdebree/beautiful-router
- npm.io page: https://npm.io/package/beautiful-router

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 1.0.4 (latest) — 2023-09-01
- 1.0.3 — 2023-09-01
- 1.0.2 — 2020-05-27
- 1.0.1 — 2020-05-27
- 1.0.0 — 2020-05-27

## README

# Beautiful Router

A fast and dynamic router for Server-Side-Rendering applications.

## How to get ?

- With NPM :

```bash
npm install beautiful-router
```

- With Yarn :

```bash
yarn add beautiful-router
```

## How it works ?

Beautiful Router will send a GET request from all links present the HTML page. Then it will storage the response in cache. So when the website viewer clicked on a link, the associated content will be injected in the view faster than the server's response waiting.

## How to use it ?

Using Beautiful Router involves than all of your pages have the same structure (header, navbar, main, footer,...), so it's advised to use a template manager like Twig to organize your partials.

- First of all import script in your HTML.

```html
<html>
  ...
  <body>
    ...
    <script src="https://unpkg.com/beautiful-router@1.0.4/dist/beautiful-router.min.js"></script>
  </body>
</html>
```

- Then insert your movable content into a tagged div element.

```html
<html>
  ...
  <body>
    <div id="router">
      <!-- Your website's content will be automatically injected here. -->
    </div>
    <script src="https://unpkg.com/beautiful-router@1.0.4/dist/beautiful-router.min.js"></script>
  </body>
</html>
```

- Finally call Beautiful Router class and enjoy your new router !

```html
<html>
  ...
  <body>
    <div id="router">
      <!-- Your website's content will be automatically injected here. -->
    </div>
    <script src="https://unpkg.com/beautiful-router@1.0.4/dist/beautiful-router.min.js"></script>
    <script>
      new BeautifulRouter("#router");
    </script>
  </body>
</html>
```

---
_Source: https://npm.io/package/beautiful-router · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
