Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Routing library for Javascript? [closed]

I used to use Backbone.js as an easy MVC framework which have build-in routing support. Now I have moved and currently using Agility.js which doesn't routing support. So my question is, is there any alternative to Backbones.js's routing?

For reference on why I need this is because my "style" of writing is a one-page website that query the server for information.

like image 228
Athiwat Chunlakhan Avatar asked Mar 25 '12 15:03

Athiwat Chunlakhan


People also ask

What is router JavaScript?

A router is a JavaScript object that maps URLs to functions. The router calls a function based on the URL. In the past, a web application was a series of interconnected pages. This could either be static pages or dynamic pages that are generated on the server.

How do you use routing in HTML?

html. Also can I route to specific div/section html tag: user enter http://mysite/ru/contacts to display contacts section in index. ru.

What is client side routing?

Client-side routing is the internal handling of a route inside of your JS file that is rendered to the front end (or client). The reason client-side routing has become something more developers have been considering when creating their apps is due to the popularity of creating single-page applications (SPAs).


1 Answers

I've faced the same question just some weeks ago and wrote "Simrou", a very basic framework that does nothing but this kind of routing (hash-based). You can define the routes in Backbone's own style and then attach action handlers to GET, POST, PUT etc. requests (GET is basically a clicked link, POST etc. can be triggered by forms).

https://github.com/buero-fuer-ideen/Simrou

like image 137
Niko Avatar answered Oct 06 '22 01:10

Niko