Questions tagged [url-routing]

URL routing is the process of mapping a URL to its content.

5061 questions
56
votes
7 answers

Difference between reverse() and reverse_lazy() in Django

I understand that we can use reverse() in FBV and reverse_lazy() in CBV. I understand that we have to use reverse_lazy() in CBV as the urls are not loaded when the file is imported (Ref: Reverse_lazy and URL Loading?) What I don't understand is:…
RyuCoder
  • 1,714
  • 2
  • 13
  • 21
55
votes
5 answers

How do I create multi-page applications with Meteor?

I am new to Javascript and just started fiddling around with Meteor out of curiosity. What really surprises me, is that it seems that all HTML content gets combined into a single page. I suspect there is a way to introduce some handling of URLs…
Marcus Riemer
  • 7,244
  • 8
  • 51
  • 76
53
votes
4 answers

Why do I need to use http.StripPrefix to access my static files?

main.go package main import ( "net/http" ) func main() { http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) http.ListenAndServe(":8080", nil) } Directory…
Dante
  • 10,722
  • 16
  • 51
  • 63
53
votes
8 answers

url with multiple forward slashes, does it break anything?

http://example.com/something/somewhere//somehow/script.js Does the double slash break anything on the server side? I have a script that parses URLs and i was wondering if it would break anything (or change the path) if i replaced multiple slashes…
Joseph
  • 117,725
  • 30
  • 181
  • 234
52
votes
4 answers

How can you access RouteData from the code-behind?

When using ASP.Net routing, how can you get the RouteData from the code-behind? I know you can get it from the GetHttpHander method of the RouteHandler (you get handed the RequestContext), but can you get this from the code-behind? Is there anything…
Deane
  • 8,269
  • 12
  • 58
  • 108
52
votes
5 answers

AngularJS - Animate ng-view transitions

I have 2 html pages, welcome.html and login.html both of which are "inserted" into index.html dependending on the URL via an ngview attribute and router provider, as part of my AngularJS app. An example of this can be found on the AngularJS home…
Greg
  • 31,180
  • 18
  • 65
  • 85
51
votes
3 answers

ASP.NET MVC URL Routing with Multiple Route Values

I am having trouble with Html.ActionLink when I have a route that takes more than one parameter. For example, given the following routes defined in my Global.asax file: routes.MapRoute( "Default", //…
Ian Oxley
  • 10,916
  • 6
  • 42
  • 49
50
votes
6 answers

Rails Routing (root :to => ...)

I know how to set the routes root of my rails app to a controller and an action. But how to add an id? /pages/show/1 should be the root. How do I set this?
Joern Akkermann
  • 3,542
  • 8
  • 33
  • 41
50
votes
4 answers

Preferred client side routing solution?

I am designing a one page browser based web application. JQuery is already being used in my application. I am currently planning to use KnockoutJS for data-binding and UI management. However I have used Backbone.js in past, and I have been quite…
lorefnon
  • 12,875
  • 6
  • 61
  • 93
48
votes
5 answers

Using routes in Express-js

So I'm starting to use Node.js. I saw the video with Ryan Dahl on Nodejs.org and heard he recommended Express-js for websites. I downloaded the latest version of Express, and began to code. I have a fully fledged static view up on /, but as soon as…
Andreas Stokholm
  • 1,677
  • 1
  • 12
  • 17
47
votes
1 answer

Angular2 router VS ui-router-ng2 VS ngrx router

What are the benefits and disadvantages of using ui-router-ng2 instead of the new Angular2 router? In the past i used ui-router with Angular 1.x instead of using ngRoute, because i need better support for nested states/routes. So now, what about…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
42
votes
5 answers

Rails: redirect all unknown routes to root_url

Whenever a user hits the wrong page, rails shows 404.html from the public folder. However, I'd like just to redirect the browser to the root page, without showing anything. So I tried globbing, but came to no avail, it still shows the 404 page.…
Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105
42
votes
5 answers

Flask and React routing

I'm building the Flask app with React, I ended up having a problem with routing. The backend is responsible to be an API, hence some routes look like: @app.route('/api/v1/do-something/', methods=["GET"]) def do_something(): return…
knowbody
  • 8,106
  • 6
  • 45
  • 70
39
votes
5 answers

ASP.NET MVC Url Route supporting (dot)

I hope that you can help me with the below problem. I am using ASP.NET MVC 3 on IIS7 and would like my application to support username's with dots. Example: http://localhost/john.lee This is how my Global.asax looks like:…
Cindro
  • 1,055
  • 4
  • 12
  • 23
38
votes
3 answers

What's the difference between application- and router level- middleware when routing in Express?

In the Express docs, it says: Application level middleware are bound to an instance of express, using app.use() and app.VERB(). Router level middleware work just like application level middleware except they are bound to an instance of…
dayuloli
  • 16,205
  • 16
  • 71
  • 126