All Projects → kriasoft → Universal Router

kriasoft / Universal Router

Licence: mit
A simple middleware-style router for isomorphic JavaScript web apps

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Universal Router

Abstract State Router
Like ui-router, but without all the Angular. The best way to structure a single-page webapp.
Stars: ✭ 288 (-81.98%)
Mutual labels:  router, routing, spa, single-page-app
Next Routes
Universal dynamic routes for Next.js
Stars: ✭ 2,354 (+47.31%)
Mutual labels:  router, routing, routes, ssr
STCRouter
基于标准URL的iOS路由系统,可实现业务模块组件化,控制器之间零耦合,可实现黑白名单控制,可进行native降级到hybrid。
Stars: ✭ 19 (-98.81%)
Mutual labels:  router, routes, routing
router
Bidirectional Ring router. REST oriented. Rails inspired.
Stars: ✭ 78 (-95.12%)
Mutual labels:  router, routes, routing
React Storefront
Build and deploy e-commerce progressive web apps (PWAs) in record time.
Stars: ✭ 275 (-82.79%)
Mutual labels:  ssr, spa, server-side-rendering
Routegen
Define your API and SPA routes in one place. Use them anywhere. Only 1.3kb.
Stars: ✭ 86 (-94.62%)
Mutual labels:  router, routes, spa
routex.js
🔼 Alternative library to manage dynamic routes in Next.js
Stars: ✭ 38 (-97.62%)
Mutual labels:  router, routes, routing
gatsby-plugin-dynamic-routes
Creating dynamic routes based on your environment and/or renaming existing routes
Stars: ✭ 14 (-99.12%)
Mutual labels:  router, routes, routing
Svelte Navigator
Simple, accessible routing for Svelte
Stars: ✭ 125 (-92.18%)
Mutual labels:  routing, ssr, spa
React Storefront
React Storefront - PWA for eCommerce. 100% offline, platform agnostic, headless, Magento 2 supported. Always Open Source, Apache-2.0 license. Join us as contributor ([email protected]).
Stars: ✭ 292 (-81.73%)
Mutual labels:  ssr, spa, server-side-rendering
Miox
Modern infrastructure of complex SPA
Stars: ✭ 374 (-76.6%)
Mutual labels:  router, ssr, spa
url
Build and parse URLs. Useful for HTTP and "routing" in single-page apps (SPAs)
Stars: ✭ 69 (-95.68%)
Mutual labels:  spa, single-page-app, routing
React App
Create React App with server-side code support
Stars: ✭ 614 (-61.58%)
Mutual labels:  ssr, server-side-rendering, single-page-app
angular-ssr
Angular 14 Example SSR (Server side rendering)
Stars: ✭ 92 (-94.24%)
Mutual labels:  ssr, routing, server-side-rendering
Redux Tower
Saga powered routing engine for Redux app.
Stars: ✭ 155 (-90.3%)
Mutual labels:  router, routing, spa
stimulus todomvc
[WIP] An implementation of TodoMVC using Ruby on Rails and StimulusJS
Stars: ✭ 14 (-99.12%)
Mutual labels:  spa, single-page-app, server-side-rendering
Rendora
dynamic server-side rendering using headless Chrome to effortlessly solve the SEO problem for modern javascript websites
Stars: ✭ 1,853 (+15.96%)
Mutual labels:  ssr, spa, server-side-rendering
Ssr Sample
A minimum sample of Server-Side-Rendering, Single-Page-Application and Progressive Web App
Stars: ✭ 285 (-82.17%)
Mutual labels:  ssr, spa, server-side-rendering
React Firebase Starter
Boilerplate (seed) project for creating web apps with React.js, GraphQL.js and Relay
Stars: ✭ 4,366 (+173.22%)
Mutual labels:  ssr, spa, server-side-rendering
Vanilla Ui Router
Simple vanilla JavaScript router
Stars: ✭ 42 (-97.37%)
Mutual labels:  router, spa, single-page-app

Universal Router

NPM version NPM downloads Library Size Online Chat

Visit Universal Router Website

A simple middleware-style router that can be used in both client-side and server-side applications.

Visit Quickstart Guide (slides)  |  Join #universal-router on Gitter to stay up to date

Features

What users say about Universal Router

Just switched a project over to universal-router. Love that the whole thing is a few hundred lines of flexible, easy-to-read code.

-- Tweet by Greg Hurrell from Facebook

It does a great job at trying to be universal — it's not tied to any framework, it can be run on both server and client, and it's not even tied to history. It's a great library which does one thing: routing.

-- Comment on Reddit by @everdimension

Installation

Using npm:

npm install universal-router --save

Or using a CDN like unpkg.com or jsDelivr with the following script tag:

<script src="https://unpkg.com/universal-router/universal-router.min.js"></script>

You can find the library in window.UniversalRouter.

How does it look like?

import UniversalRouter from 'universal-router'

const routes = [
  {
    path: '', // optional
    action: () => `<h1>Home</h1>`
  },
  {
    path: '/posts',
    action: () => console.log('checking child routes for /posts'),
    children: [
      {
        path: '', // optional, matches both "/posts" and "/posts/"
        action: () => `<h1>Posts</h1>`
      },
      {
        path: '/:id',
        action: (context) => `<h1>Post #${context.params.id}</h1>`
      }
    ]
  }
]

const router = new UniversalRouter(routes)

router.resolve('/posts').then(html => {
  document.body.innerHTML = html // renders: <h1>Posts</h1>
})

Play with an example on JSFiddle, CodePen, JS Bin in your browser or try RunKit node.js playground.

Documentation

Books and Tutorials

Browser Support

We support all ES5-compliant browsers, including Internet Explorer 9 and above, but depending on your target browsers you may need to include polyfills for Map, Promise and Object.assign before any other code.

For compatibility with older browsers you may also need to include polyfills for Array.isArray and Object.create.

Contributing

Anyone and everyone is welcome to contribute to this project. The best way to start is by checking our open issues, submit a bug report or feature request, participate in discussions, upvote or downvote the issues you like or dislike, send pull requests.

Support

Related Projects

  • React Starter Kit — Boilerplate and tooling for building isomorphic web apps with React and Relay.
  • Node.js API Starter Kit — Boilerplate and tooling for building data APIs with Docker, Node.js and GraphQL.
  • ASP.NET Core Starter Kit — Cross-platform single-page application boilerplate (ASP.NET Core, React, Redux).
  • Babel Starter Kit — Boilerplate for authoring JavaScript/React.js libraries.
  • React App SDK — Create React apps with just a single dev dependency and zero configuration.
  • React Static Boilerplate — Single-page application (SPA) starter kit (React, Redux, Webpack, Firebase).
  • History — HTML5 History API wrapper library that handle navigation in single-page apps.
  • Redux-First Routing — A minimal, framework-agnostic API for accomplishing Redux-first routing.

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

License

Copyright © 2015-present Kriasoft. This source code is licensed under the MIT license found in the LICENSE.txt file. The documentation to the project is licensed under the CC BY-SA 4.0 license.


Made with by Konstantin Tarkus (@koistya, blog), Vladimir Kutepov and contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].