routing

Node, Express - CANNOT GET route

ⅰ亾dé卋堺 提交于 2019-12-04 11:34:44
问题 I am building an Express app and having some issues with routing. My '/' route is working perfectly, however other routes are not. I've looked into other questions people have posted and these have not resolved my issues. I have a routes/index.js file: module.exports = function(app){ app.use('/', require('./routes/home')); app.use('/about', require('./routes/about')); } My routes/home.js: - WORKING! const express = require('express'); const router = express.Router(); router.get('/', function

Asp.Net System.Web.Routing Find actual .aspx Page

半腔热情 提交于 2019-12-04 10:12:06
I'm using System.Web.Routing to have some better URL's and have come across a problem. I need to know the actual page that's handling the request. for example a request comes in as: /basketball/home I need to find the page that handles that request, like: /management/default.aspx I'm only using the System.Web.Routing and not MVC. I have a handle to the RequestContext that contains some of the route information, but i don't see what i need. Thanks in advance. ******* UPDATE ******* I was able to use Context.CurrentHandler which give me "ASP.management_default_aspx" , not exactly the page but

Is there a callback in ember.js which I can use to run code after all views are rendered after state transition?

时光毁灭记忆、已成空白 提交于 2019-12-04 10:08:26
I've got application view consisting of three outlets: <script type="text/x-handlebars" data-template-name="application"> {{outlet header}} {{outlet content}} {{outlet footer}} </script> which render their own views (simplified): <script type="text/x-handlebars" data-template-name="header"> <a href="#" data-role="button" data-icon="arrow-l" data-iconpos="notext" {{action changeDate view.prevDate href=true}}>Prev</a> {{view.model.weekDay}} <a href="#" data-role="button" data-icon="arrow-r" data-iconpos="notext" {{action changeDate view.nextDate href=true}}>Next</a> </script> <script type="text

WebApi2 attribute routing inherited controllers

梦想的初衷 提交于 2019-12-04 10:07:52
I'm trying to create basic REST api with a base controller like so: Base class: public abstract class WebApiEntityController<TEntity> : ApiController where TEntity : EntityBase<TEntity, int> { private readonly IRepository<TEntity> _repository; protected WebApiEntityController(IRepository<TEntity> repository) { _repository = repository; } [Route("")] [WebApiUnitOfWork] public HttpResponseMessage Get() { return Request.CreateResponse(HttpStatusCode.OK, _repository.ToList()); } [..........] Derived class: [RoutePrefix("api/TimesheetTask")] public class TimesheetTaskController :

MVC Ajax.ActionLink doesn't find POST method

心已入冬 提交于 2019-12-04 09:29:52
问题 I have a POST method declared in my controller: [AcceptVerbs(HttpVerbs.Post)] public ActionResult UpdateComments(int id, string comments) { // ... } and an ActionLink in my view: <%= Ajax.ActionLink("update", "UpdateComments", new { id = Model.Id, comments = "test" }, new AjaxOptions { HttpMethod="POST", OnFailure="alert('fail');", OnSuccess = "alert('success');" })%> I get a "not found" error when it tries to route this request. If I remove the POST restriction from the UpdateComments method

Ending a Rails 2 URL with an IP address causes routing error?

一个人想着一个人 提交于 2019-12-04 08:42:54
问题 I'm trying to construct URLs in the format http://servername/find/by/CRITERION/VALUE CRITERION is a finite set of strings, as is VALUE. Trouble is, VALUE needs to be an IP address in some situations, and it's causing me a routing error. Here's my route: map.find 'find/by/:criterion/:query', :controller => "find", :action => "by" And the error, from the Mongrel logs: Processing ApplicationController#index (for 127.0.0.1 at 2010-05-07 10:20:32) [GET] ActionController::RoutingError (No route

Rails change routing of submit in form_for

拜拜、爱过 提交于 2019-12-04 08:35:58
问题 I have a model 'Article' and a model 'Ratings' nested within articles. /articles/123/ratings I want to change the routing of the f.submit in ratings/_form.html.erb now it is so, that after pressing submit, my application routs to /ratings/111 but I want to route it to /article/123 How can I change the routing in a form_for f.submit button. I have found here something like this: <% form_for :thing, :url => url_for(:action => "update", :id => @thing) do |f| %> But this do not work for my rails

Why Laravel still logging a NotFoundHttpException while all routes works?

混江龙づ霸主 提交于 2019-12-04 08:23:23
All my registered routes are working. They display the view, yet on every request a NotFoundHttpException shows up in my log file. I'm using NGINX. Could it be my NGINX config? The error that is logged on every request (even though the view shows up): log.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Routing/Router.php:1429 Stack trace: #0 /usr/share/nginx/www/example-staging/releases/20130815024541/vendor/laravel/framework/src/Illuminate/Routing/Router.php

Why won't this route match

纵饮孤独 提交于 2019-12-04 07:14:19
I'm having some trouble getting routes to match. I am using base-32 encoded int's as short links to slideshows in a web app. There are 5 different versions of each slideshow, and I am using an initial letter to distinguish between each version. The routes always match, except when the first character of the base-32 encoded int is the same as the character designating the slideshow version. This anomaly exists for all 5 prefix letters: n, f, c, x, and h. What about the first two characters being the same makes these routes not match? I'm at a loss to understand what's going on here (when the

ID unique to nested model, not unique globally?

最后都变了- 提交于 2019-12-04 07:05:14
问题 I have nested routes for a has_many and belongs_to relationship. resources :websites, :path => 'w' do resources :pages, :path => '' end I'm using friendly ID gem to replace the page ID in the URL with a slug. So my URLs look like this http://example.com/w/1-website-name/page-name However, when a duplicate page name is added, friendly ID appends a random hash to it to make it unique, even if the page belongs to a different website. Is there a way I can make it so page names only must be unique