FAQ Database Discussion Community


Defaulting route to /api/:version in MEANJS

express,routes,meanjs
I am relatively new to MEANJS, i have also been reading through its documentation to learn more. so, i am trying to create a rest API using meanjs using its yo generator and removing the angular parts of it, so far it has been a success. What i am trying...

Laravel Route - Nested Resource Controllers without intermediate page

php,laravel,routes,resources
I have two controllers - ChController & FillController . ChController works fine. Route::resource('c', 'ChController'); | | GET|HEAD | c | c.index | App\Http\Controllers\[email protected] | | | | GET|HEAD | c/create | c.create | App\Http\Controllers\[email protected] | | | | POST | c | c.store | App\Http\Controllers\[email protected] | | | | GET|HEAD...

Basic nodejs route resulting in 404

javascript,angularjs,node.js,express,routes
I am trying to create two separate routes in NodeJS, I am using the express framework and angular on the client side. I am currently able to render my index page successfully by visiting localhost:3000/ although when I try to render the login page by visiting localhost:3000/login I am getting...

Pass 'use' objects to Routes with Slim Framework

php,pdo,frameworks,routes,slim
I have just began using Slim Framework for a very basic REST API project and it is absolutely perfect for my needs. I am however trying to determine how to use both route groups in combination with passing objects to the routes through 'use'. How can I pass the $app...

ReactJS route optional ID URL param

url,routes,reactjs
So, I've tried all this but none of them work. <Route name="create-course" handler={CreateCourse} path="/course-builder/create-course/{:id}" /> <Route name="create-course" handler={CreateCourse} path="/course-builder/create-course/[:id]" /> <Route name="create-course" handler={CreateCourse} path="/course-builder/create-course{/id}" /> variants of the same error: Error: Invariant Violation: Missing "id" parameter for path "/course-builder/create-course/{:id}" /{:id?} one doesn't throw an error but URL becomes...

Is it possible in laravel 5 to show a pretty url to the user, and a practical url to the app?

routing,routes,laravel-5,friendly-url,slug
I have this url: mywebsite.com/user/1/edit I want my users to see this: mywebsite.com/edit-your-profile/ Is this possible when using Route::resource('user', 'UserController');? If yes, how do I do it :) ? I still want my app to be able to see user/1/edit as I use it in my middleware to prevent unauthorized...

Inconsistent CodeIgniter routes.php behaviour

codeigniter,routes
I'm using CodeIgniter's routes file to remap short urls to their relevant controller functions. Oddly enough, some urls get remapped, while others don't, even though the syntax is identical. Below is my routes.php file. The remapping of info/web and info/rent works as expected, while info/cell and info/hotel gets redirected to...

How to remove the prefix generated in routes.rb for the params in the path

ruby-on-rails,ruby,routes,nested-routes
Currently in my routes I have: # USER RESOURCES resources :users do resources :repositories patch 'change_password' get 'account_setting' end Which generates this path for the account_setting action: user_account_setting GET /users/:user_id/account_setting(.:format) users#account_setting What I want is to have: user_account_setting GET /users/:id/account_setting(.:format) users#account_setting The two are essentially the same thing, but the...

Laravel 5 named route to controller action

php,laravel,controller,routes,laravel-5
I have a REST Controller which I extended with a new action verify(). Now I want to call this action via a named route, but when I open www.foo.bar/verify I get an error: BadMethodCallException in Controller.php line 273: Method [verify] does not exist. When I call the action create instead...

Laravel 5 RESTful resource route not working

php,rest,routes,laravel-5
I have Laravel 5 resource route: Route::group(['middleware' => 'auth'], function() { Route::resource('api/room', 'RoomsController'); // ... }); The RoomsController is generated with php artisan make:controller command. <?php namespace App\Http\Controllers; use Auth; use App\Room; use App\RoomUsers; use App\Http\Requests; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class RoomsController extends Controller { // ... } The index...

Route parameter patterns on routes with similar parameters

php,laravel-4,routes
I have a few routes that takes a couple of UUIDs as parameters: Route::get('/foo/{uuid1}/{uuid2}', [email protected]'); I want to be able to verify that those parameters are the correct format before passing control off to the action: Route::pattern('uuid1', '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$'); This works fine. However, I really don't want to repeat that pattern...

Route Not Working in Rspec

ruby-on-rails,rspec,routes
Given the follow rails route ... post '/a/link.aspx', to: 'vendor_simulator#an_action' and the route shows as ... Prefix Verb URI Pattern Controller#Action POST /a/link.aspx(.:format) vendor_simulator#an_action And the following passing test ... it "returns http success" do post :an_action, return_xml, :content_type => 'application/xml' expect(response).to have_http_status(:success) end Why does the following test fail...

Rails - SEO friendly URLs with Self joined models

ruby-on-rails,routes
Right now there are two models: Category and Product. Categories are self joining to make sub_categories. Category has_many Product, who of course belongs_to Category. The question I have is this: How Do I map the routes for these resources so that they have SEO friendly URLS. For example: If the...

Showing a username in the URL

angularjs,twitter-bootstrap,routes
I have a single page Angular + bootstrap app where the user can enter their username (no password) into a text input and their user info will be displayed on screen. I wish to make it so that when a user's info is displayed on the screen, the URL changes...

Is there a way to add route to Rails by command line?

ruby-on-rails,ruby,routes
I am a beginner in ruby on rails. I found it quite inconvenience to add route to route.rb manually every time I add a new action or page to controller or the project. So I want to know if there is a way using command line rather than editing the...

WebApi Routing issue - unable to route to required action

routes,asp.net-web-api2
I've used the selected answer from here: Routing based on query string parameter name to build my routes but they don't work as expected: my route: config.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}", defaults: new { controller = "Products" } ); my actions: public string GetProductById(int id) {} public string GetProductByIsbn(string isbn)...

Rails extended “show” function

ruby-on-rails,ruby-on-rails-4,model-view-controller,controller,routes
I'm beginner and can't figure out where to start with this problem. I have fully functional Entities Controller where I can make new Entity and add all info I need. Now I would like to have simple button on Show page that will direct me from Example/entities/12 to Example.com/entities/12/custom_view page...

Rails 4 Method Not Allowed after Upgrading from Rails 3

jquery,ajax,ruby-on-rails-4,routes
I've got an existing codebase that I'm attempting to upgrade from Rails 3.2 to Rails 4.0 I have controller called assets_controller with a 'create' method and I have a an entry in my routes file: resources :assets Using Jquery on the front end, if I send a post request to...

How can I route to SessionsController#create in my login form?

ruby-on-rails,routes
Here's how I have my login form set up: <%= form_tag login_path, method: "post", class: "well form-search" do |f| %> Naturally, this tries to POST to the "new" action of my SessionsController. I know that login_path is evaluated before method so I know that this is completely wrong. Just trying...

Adding authorization to routes

ruby-on-rails,rest,routes,authorization
I cannot seem to find a good example for this. I have for example, a TicketController I define a ticket resource in my routes.rb. You only need to be logged in as a customer to GET a ticket, but you must be logged in as an administrator to PUT a...

Mapping all routes and its http methods in Goji

go,routes,goji
I would like to map each route and it's request type (GET, POST, PUT, ...) to generate something like a sitemap.xml in JSON for my restful API. Goji uses functions to create a new route. I could store the paths and handlers in a map. My approach would be something...

error calling metod and/or action controller

ruby-on-rails,ruby-on-rails-4,routes,action
i have this problem: I should decrement an attribute "quantity" of a line_item. So i created a button_to to do this. The problem is that even if i created the new action "less" in the controller of line_item and added it in the routes , my function doesn't work. Can...

External URL id as Rails id Route [closed]

ruby-on-rails,ruby,json,model-view-controller,routes
I haven't really got into routing with any framework and Routing is already complicated as it is. I need some help with it. Im grabbing some data from an iTunes json file. I have all the top songs listed in my view. What I want to do is set up...

How to programmatically list all devise routes

ruby-on-rails,ruby,devise,routes
I'm using devise to authenticate my users in my Rails 4.1.9 application. I need to list all devise routes in a javascript file. I tried to do something like this: all_routes = Rails.application.routes.routes.map do |route| route.path.spec.to_s.gsub('(.:format)', '') end This simply prints all rails routes. How can I get only devise...

Rails - link_to a specific item#show

ruby-on-rails,url,routes
Using the Rails model and controller, I have created a few items. Each item has a year (2011, 2012, 2013, 2014, 2015). I can access the items#show by using a vanity URL that I defined: example.com/items/2015-item. This works for any year and item. In the top navigation bar, I have...

Child route template not rendered when parent overrides renderTemplate

ember.js,routes
My routes are: this.resource('workpaper', function() { this.route('add'); }); For the workpaper route I would like to decide which template is rendered, so in the WorkpaperRoute I override renderTemplate(): renderTemplate: function(controller, model) { this.render('workpaper/index'); } The problem is that when I navigate to the add route, the workpaper/index template is rendered,...

What is the best way to restrict any routes in Laravel 5.0?

php,laravel,routes,laravel-5,php-5.5
I want to restrict some routes of my application and only allow that to only my authenticated user. I tried check using the auth:check() function but it doesn't seem to work. // Route Restriction if (Auth::check()){ //Web Directory Route::get('web-directory',[email protected]'); } When I got to mysite/web-directory I still get 404 Error...

Debugging web API back-end and angular front-end as two projects in one solution

angularjs,visual-studio,asp.net-mvc-4,routes,web-api
I have one solution in Visual Studio 2013 which contains MVC Web API and Angular app. I have set Multiple Startup Projects so both projects start in the same time when debugging. The both start OK, but they are running on different ports so there is no way for front-end...

How to pass parameters to a controller when using route?

javascript,angularjs,html5,routes
In my application, am loading views using ngRoute, .state('ReportViewer', { url: "/ReportViewer", controller: 'ReportViewerControl', templateUrl: "views/Report_viewer.html" }) I have a search Panel where users can search reports, and when selecting a report, it should route to a different page and load the report inside an iframe. Here is my code...

Check if file exists for ng-include in $routeProvider template

javascript,html,angularjs,node.js,routes
I've setup my Angular routes to use the slug from the URL to determine what file to load. It looks like this: $routeProvider.when("/project/:slug", { controller: "ProjectController", template: function($routeParams){ return '<div id="project" ng-include="\'/views/' + $routeParams.slug + '.html\'"></div>'; } }); Works a charm, but there's no fallback here if the file for...

Rails Devise Routes: If user signed in, point to index. Else, point to new user session

ruby-on-rails,ruby,if-statement,devise,routes
Pretty simple question, but I can't seem to find the answer with a good ole fashioned Google. The error: undefined method `user_signed_in?' for #<ActionDispatch::Routing::Mapper:0x007fc6369320e8> (NoMethodError) Server won't even start. My code: Rails.application.routes.draw do devise_for :users, :path_prefix => 'u' resources :users devise_scope :user do get "login", to: "devise/sessions#new", as: :login get...

Rails 4 routing issue, or something else; I am not sure at this point

ruby-on-rails,ruby-on-rails-4,controller,routes
Okay, these dashboard pages originally worked when I was trying to render them within the main controller generated with scaffold. I opted to try and split them off into their own controller. I am copying much of this from another app, but it is rails 3 and I am using...

AngularJS doesn't routes second slash. How can i do that?

angularjs,routes,angular-ui-router,ionic-framework,ionic
I'm using the Ionic Framework with AngularJS and i'm very newbie at this point. All of my states are working except one and i couldn't find what is the problem. I can say my second slash navigation is not working. I couldn't navigate to the link ("#/tabs/dash/Restaurant/test/test2") STATES: .state('tab.dash', {...

How do I split up index.js file in a node/mean/express application?

javascript,node.js,express,routes,refactoring
I've got one incredibly long index.js route file for my node/mongo/express application. Here is the structure. app.js /models Schedule.js Task.js etc... /routes index.js /public /javascript etc... I want something like this app.js /models Schedule.js Task.js etc... /routes index.js schedule.js tasks.js etc... /public /javascript etc... How can I split up my...

How to map all OPTION requests to a certain controller in play 2?

java,playframework,routes
How can i route all OPTION requests to a certain controller in play 2+? I have this route in routes file : OPTIONS / @controllers.CORSController.preFlight I also need to route all OPTION requests to the same controller like : OPTIONS /dev/upload @controllers.CORSController.preFlight OPTIONS /some/path @controllers.CORSController.preFlight ... how can i achieve...

Ruby on Rails: Route a deprecated URL to application's root

ruby-on-rails,routes
How would I write the Rails route in config/routes.rb when I need to point a deprecated URL that still exists on someone else's website I can't control ('/something/article.jsp?id=1787') to the root of my application? How would the below (wrong) attempt need to be corrected? get '/something/article.jsp?id=1787' => 'root#index' ...

PHPStorm and CodeIgniter routing issue

php,codeigniter,routes,phpstorm
I started studying CodeIgniter Web Framework and I am trying to work with PHPStorm 8.0.3 on Kubuntu 14.04. When I unzip CodeIgniter downloaded archive to root Apache folder /var/www/html and go to localhost/index.php then it works okay and I see "Welcome to CodeIgniter!" page. Also I can use localhost/index.php/welcome/index and...

How to use $_GET with mod_rewrite and AltoRouter

php,.htaccess,mod-rewrite,routes
I am having issues getting $_GET variables with mod_rewrite enabled. I have the following .htaccess: RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [L] and I am using "AltoRouter" for routing. So an example of a Route that I might have is /login?redirect=localhost%2Fnetwork%2Fdashboard which would be rewritten as /login. What I am...

How can I make ui-router controller to work?

javascript,angularjs,routes,angular-ui-router
I've set up two simple URLs, with simple different templates and the same controller, but it doesn't work HEAD: <script src="jsLib/angular_v1.4.js" type="text/javascript"></script> <script src="jsLib/angular-ui-router.min.js" type="text/javascript"></script> <script src="routes.js" type="text/javascript"></script> <script src="app.js" type="text/javascript"></script> HTML: <body ng-controller="MainCTRL as ctrl"> {{ctrl.nameApp}} <div ui-view></div> app.js: angular...

How sending parameter in the controller method of Silex - PHP

php,routes,silex
I'm using silex and I'm trying to pass a parameter controllers , but do not work. My code below: <?php error_reporting(E_ALL); ini_set('display_errors', 1); require_once __DIR__ . '/vendor/autoload.php'; use Silex\Application; use Symfony\Component\HttpFoundation\Request; class TestController { public function testAction(Request $request, Application $app, $value) { var_dump($value); return 'test'; } } $app = new...

using dart route package url got error 404

routes,dart
Here's my main.dart: import 'dart:html'; import 'package:route/client.dart'; import 'urls.dart'; void main() { var router = new Router() ..addHandler(homeUrl, showHome) ..addHandler(galleryurl, showGallery) ..listen(); HttpRequest.getString("home.html").then((html){ querySelector("#container").innerHtml = html; }); } void showHome(String path){ HttpRequest.getString("home.html").then((html){ querySelector("#container").innerHtml = html; }); } void showGallery(String path){ HttpRequest.getString("gallery.html").then((html){...

CodeIgniter - How to route a controller with other name?

codeigniter,routes,codeigniter-url,codeigniter-routing,codeigniter-3
I have installed an authentication module named bit_auth in my codeIgniter. I have a controller for that module named "bit_auth" so when calling functions on my controller my urls will be like this: http://(mydomain.com)/bit_auth/ http://(mydomain.com)/bit_auth/edit_user/1 http://(mydomain.com)/bit_auth/activate/7b60a33408a9611d78ade9b3fba6efd4fa9eb0a9 Now I want to route my "bit_auth" controller to be called from "http://(mydomain.com)/auth/...". I...

How can I define a route differently if parameter is not integer

php,laravel,routes
I am using Laravel 5 and working on my local. I made a route with a parameter of {id} and another route with a specific name like so : Route::get('contacts/{id}', [email protected]_contact'); Route::get('contacts/new', [email protected]_contact'); My problem here is that if I try to go at localhost/contacts/new it will automatically access to...

Recommended way to delete object in MongoDB based on a route

node.js,mongodb,express,routes
New to the MEAN stack development, but loving it! I want to ask this question in such a way that it isn't opinion based, so forgive me if it is. Lets say I have an admin dashboard that lists out the objects in a MongoDB collection. Each item has a...

How do I load some data from database before any view function is called in Flask?

session,flask,routes
Using Flask, how do I count notifications for a user as soon as the program runs, since the user can begin from any page (route)? I don't want to tie the code that retrieves this value to any view function in particular, rather I want it to be computed at...

ASP.NET MVC routing 404

asp.net,json,asp.net-mvc,routes
I have add a new route in a default mvc project like this: routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( name:"test", url:"{controller}/{userId}/{action}/{cardId}", defaults: new {controller="User", userId=UrlParameter.Optional, action="card", cardId=UrlParameter.Optional } ); And I have a action method like...

No route matches [Post] /characters/1/edit

ruby-on-rails,ruby,routes
I am trying to reach the edit page for my character class, but for some reason it is routing with a POST when it should be a GET. All similar questions have not helped. Here is my edit function: def edit end Here are my routes: <%= button_to 'Edit Character',...

Node forward path request to another server

node.js,express,routing,routes,request
Currently have a website running a node server that handles all requests for example.com and I created a completely separate wordpress blog on a separate server (running apache) that I would like served on a path like example.com/blog at 172.23.23.23 IP address. The wordpress server doesn't share any code or...

How Do I Use the route_translator gem and not require the Locale?

ruby-on-rails,localization,routes,internationalization,rails-i18n
I'm able to successfully use the route_translator gem when I require a locale. When I change between the two locales I have (en:fr) I have no problems clicking any of the links and displaying the correct views and link translations. Here is my config/routes.rb file where my routes work as...

Laravel - multiple routes

php,laravel,routes
I'm doing a simple project. I want it to be as minimal as possible so I tried to create system where I can create pages and they're placed at localhost/{page?} But, here's the problem. I also want some routes to be defined (e.g. route /blog) like below. Route::get('/{page?}', ['as' =>...

Routes don't work correctly at Laravel 5.0 (404 Error)

php,laravel,routes
I switched to Laravel 5.0 and try to introduce myself. I have a small problem which confuses me: I use two Controller classes. The first works fine but the second one gets ignored. Could somebody tell me why? routes.php <?php Route::controller('/', 'IndexController'); Route::controller('/rezeptliste', 'RecipelistController'); IndexController.php <?php namespace App\Http\Controllers; class IndexController...

Reload controllers after scope change (AngularJS)

javascript,angularjs,view,routes,scope
so I have this controller for swapping languages app.controller("langCtrl",['$scope','$route',function($scope,$route){ this.swap_lang = function(){ if(lang == "tr"){ lang = "en"; }else{ lang = "tr"; } console.log(lang); this.lang = lang; //$route.reload(); //$scope.$apply(); }; }]); And this one below is supposed to be responsible for bringing up menus (JSON files with short language codes)...

Routes filtering by Language and/or category

python,flask,routes
I'm building a StumbleUpon like application which the content has to be filtered by language and category. I have two simple routes for each, language and category, but I would like to know if it's possible to have both in one simple router declaration. To not get confused I'm using...

how to use named routes in view where named routes have wildcard

php,routes,laravel-5,blade
I've a group routes like this Route::group(['prefix' => 'admin/{username}'],function() { Route::get('', ['as' => 'dashboard', 'uses' => [email protected]']); Route::get('settings', ['as' => 'settings', 'uses' => [email protected]']); }); In my view i used named routes for link reference like this <li><a href="{{ route( 'settings' ) }}"><span>Settings</span></a></li> but it's rendering as <li><a...

Expecting Zend to fail to find an action, but instead it finds it and tries to render a view

php,routes,zend-framework2
With an action such as public function checkImagesAction() I can request that route in my browser with /checkImages and the page is displayed using the check-images.phtml view as I'd expect. However, requesting /checkImageS or another crazy spelling causes Zend to throw a RuntimeException because it is unable to render template...

Automate Entrust permission with accessing the Route name parameters and check for user's permission

php,permissions,routes,laravel-5,acl
I have implemented Entrust Roles for ACL layer. Now I'm planning to automate the permission check for each request so that, each time I don't have to write the permission for the user roles. eg. I have company resource, and user role as 'admin', he can only view company and...

Laravel 5 misroute?

php,laravel,routes
I'll copy the relevant code and then i'll explain the problem. routes.php get('/movies/create', [email protected]'); Moviecontroller.php public function create() { return view('movies.create'); } master.blade.php <html> <head> <title>Laravel</title> </head> <body> @yield('content') </body> </html> edit.blade.php @extends('master') @section('content') <h1>Edit {{ $movie->name }}</h1> {!! Form::model($movie, ['url' => '/movies/' . $movie->id, 'method' => 'PATCH']) !!}...

Redirect to a homepage cakephp 3

php,redirect,routes,cakephp-3.0
I've followed the articles tutorial from cakephp 3 website and created the website http://i.imgur.com/JMh1Pwv.png Now there is add article, delete article and edit article actions. When I delete an article it redirect me to http://localhost:8888/test/articles/delete/14 Here is the delete code. public function delete($id) { $this->request->allowMethod(['post', 'delete']); $article = $this->Articles->get($id); if...

Simple Route to an action in another controller

c#,.net,asp.net-mvc,routes,annotations
i have an MVC .Net C# project. have Plan Action under Home Controller. but i dont want to access this page as http://....../Home/Plans but i want to access it as http://....../Plans but i dont want to create Plans Controller. so i dont want to do a redirectToAction. i am trying...

ActionLink (LinkText,Action,ControlName,AreaName,RoutesValue,html attribute)

asp.net,asp.net-mvc,routes,actionlink,asp.net-mvc-6
A bottom'd like code samples ActionLink (LinkText,Action,ControlName,AreaName,RoutesValue,html attribute) I looked at the sites do not have all of these together Thanks

ZF2 Segment Route doesn't match parent's constraint when using children

regex,routing,routes,zend-framework2,zend-route
I created the following routes: 'relatorios' => array( 'type' => 'Zend\Mvc\Router\Http\Segment', 'options' => array( 'route' => '/relatorios/:tipo', 'defaults' => array( 'controller' => 'Relatorios', 'action' => 'index', 'tipo' => 'normais', ), 'constraints' => array('tipo' => '(normais|administrativos)$', ), 'may_terminate' => true, 'child_routes' => array( 'view' => array( 'type' => 'Zend\Mvc\Router\Http\Segment', 'options' =>...

Symfony2.7.0 app_dev.php route not found

php,symfony2,routes,symfony-2.7
I am learning symfony2, I have installed symfony2.7.0 LTS using below command. symfony new sflearning and I have installed symfony2.7.0 successfully. Now when I am trying run app_dev.php on localhost using below url, http://localhost/sflearning/web/app_dev.php It gives me an error No route found for "GET /" It was working with previous...

Redirecting Ethernet traffic through another interface

routes,embedded,protocols,ethernet,dhcp
I'm working on a project where I want to redirect ethernet traffic through another interface. The setup is as follow: I have a computer with a working internet connection. I also have a MBED LPC1768 board which I can connect by USB with my computer. I can upload a binary...

Create new route Rails 4

ruby-on-rails,ruby-on-rails-3,ruby-on-rails-4,routes
I have a problem: I want do decrement the quantity of a product of a line_item I use a button_to to decrement the quantity (the cart will be updated by AJAX) Btw , i' m not able to create a new action in the controller of line_items. I created the...

How to add a specific sidebar to meteor route?

meteor,routes,handlebars.js
For example I have an admin area and I want to display a specific sidebar for admin navigation <body> {{#if adminRoute}} {{> sidebarAdminNav }} {{> yeld }} {{else}} {{> yeld }} {{/if} </body> ...

How to handle one express route different than all other

javascript,node.js,express,routes
I'm currently using the Express router within a NodeJS application. I have simply been using app.use(app.router); for routing and it works well. However, I'm now testing out some new routes and want to handle them differently. Ideally I would like to be able to say: var vers2Router = require('./routes/version2'); app.use('/version2',...

Render a 'micropost feed' from the Rails Tutorial in a custom location/view?

ruby-on-rails,routes,custom-routes
I followed Michael Hartl's 'Rails Tutorial' book and need to render the 'micropost feed' at a custom location (/members) instead of at the site's root. I've updated the SessionsController so that when a user logs in they are redirected to the new /members URL, but there are two statements needed...

Hiding routes in ASP.Net MVC 4

c#,asp.net,asp.net-mvc-4,model-view-controller,routes
In my application I have various Views and Controllers. So naturally when one navigate through pages the URL will change based on the Controller and the View; E.g. http://example.com/home/index http://example.com/account/register http://example.com/product/newproduct But I would like to keep the Controller and View name in the address bar secret, in other words...

current_page? in a _partial view keeps erroring

ruby-on-rails,ruby,routes
I'm using a _form partial which contains my Create and Edit template for my model Products. I have the following code to check if it's the Edit View <% current_page?(edit_product_path(@product)) %> However when I enter the create view the site falls over with the following error No route matches {:action=>"edit",...

Using '.' in Web Api using Attribute Routing is giving 404 error

asp.net-web-api,routes,asp.net-web-api2,asp.net-web-api-routing,attributerouting
I am using Routing Attribute to try to send a string via url to my web Api. I have a Route defined as [Route("Search/{searchText}")] I am expecting a string value as searchText. It seems to be working fine but I am getting an error if there is a '.' in...

How to reload a route using hasher.js and crossroads.js?

javascript,jquery,routes
I currently have this code: crossroads.addRoute('/login', function(){ $.ajax({ url: '/login', type: 'GET', data: { }, success: function(msg) { $('#' + main_window).html(msg); } }) }); Along with this hasher.js for maintaining history: function parseHash(newHash, oldHash){ crossroads.parse(newHash); } hasher.initialized.add(parseHash); //parse initial hash hasher.changed.add(parseHash); //parse hash changes hasher.init(); //start listening for history change...

Easy way to access $route from html side in AngularJS

javascript,html,angularjs,routes
Is there a way to access $route from the html side of AngularJS? I'd really like to do something like this in HTML and eliminate yet another $scope function. (yes, i know its not really something that works): <button ng-disabled="!route.current.scope.currentform.$valid"> I am working on a large angular application that is...

PHP Silex routes base url

routes,silex,base-url
My project is just a test API project on a local server in a subfolder. So my url would be http://localhost/test-project-x/api/. In there is an index.php. The root route is available through the URL above. But as soon as I go to http://localhost/test-project-x/api/test I get a 404. To get this...

Playframework scala class controller vs object controller

routes,playframework-2.3
How to define a controller class in playframework (that will be injected by a dependency container)? For the app/controllers/controller package controllers import play.api.Play /*object*class MainController(name:String) { import play.api.Play.current def index = Ok(Html("index ok "+name)) } My app/Global.scala package app object Global extends GlobalSettings with SecuredSettings with Logger { override def...

Get Path from array in Rails 4

ruby-on-rails,ruby-on-rails-4,routes
I wonder is there possibility to get path from array outside views (in my case in model) like in link_to method - link_to 'User', [:admin, @user] . For example I want to store admin_artist_path (unfortunately real problem is more complex because I can't predict what path will be ) class...

Attributed Routing with multiple parameters in Web API 2

routes,asp.net-web-api2,attributerouting
I am trying attributed routing with Web API 2. I have defined a route prefix and I have two methods. The first one works but the second one fails [RoutePrefix("api/VolumeCap")] public class VolumeCapController : ApiController { [Route("{id:int}")] public IEnumerable<CustomType> Get(int id) { } [Route("{id:int}/{parameter1:alpha}")] public CustomType Get(int id, string parameter1)...

Nested Routing Error in Rails

ruby-on-rails,ruby,ruby-on-rails-4,routes,controllers
I keep getting this error and don't get how to fix it. Please help. I want to have a "complete order" button on my sales history page which creates a Post action to begin the transfer orders/sales.html.erb <% @orders.each do |order| %> <tr> <td class="center"><%= order.profile.user.first_name %></td> <td class="center"><%= number_to_currency(order.profile.price)...

How to change the 'micropost feed' URL from Rails Tutorial?

ruby-on-rails,routes
I'm following Michael Hartl's book 'Rails Tutorial' and need to change the logged in URL to render at /members instead of at the site's root. I've tried changing home.html.erb from: <% if logged_in? %> <div class="row"> <aside class="col-md-4"> <section class="user_info"> <%= render 'shared/user_info' %> </section> <section class="stats"> <%= render 'shared/stats'...

Rails Routes issue on heroku

ruby-on-rails,routes
My app working fine on localhost but when I push app on heroku, its show error on heroku. Heroku log below ActionController::RoutingError (No route matches [POST] "/forgot_password"): and below is rake routes result My app working fine on localhost but when I push app on heroku, its show error on...

Routes in laravel5 don't work correctly

php,laravel,caching,routes
Today I have the following problem with this routes , It has never happened to me before now. {!! Form::open(array('route' => 'subastas/creado', 'class' => 'form')) !!} <div class="form-group"> {!! Form::label('Your Name') !!} {!! Form::text('name', null, array('required', 'class'=>'form-control', 'placeholder'=>'Your name')) !!} </div> <div class="form-group"> {!! Form::label('Your E-mail Address') !!} {!! Form::text('email',...

Passing innerHtml value as parameter for play framework routes

html5,playframework,routes
hello i am trying to pass inline edited table value as a parameter to play routes can someone help me with the same here is my html code <table class="gradienttable"> <thead> <tr> <th>Task</th> <th>TimeSheetdate</th> <th>Hours</th> <th>IsBilled</th> <th>Work Place</th> </tr> </thead> <tbody> @for(element <- CurrentPage) { <tr> <td contenteditable="true" id="task1">@element.getTask()</td>...

Route for mailer link

ruby-on-rails,ruby,ruby-on-rails-4,routes,railstutorial.org
Account activation The route and mailer link that I use for account account activation are as follows: # Route: resources :account_activations, only: [:edit] # Link in mailer: <%= edit_account_activation_url(@user.activation_token, email: @user.email) %> The link generates a link such as http://www.example.com/account_activations/q5lt38hQDc_959PVoo6b7A/edit?email=foo%40example.com. The controller method uses the email address to find the...

Laravel 5 - Routing with optional prefixes

php,routes,laravel-5
I would appreciate some help with routing in Laravel 5. I've got three models: ReasearchLine, ReasearchGroup and Publications. Each ReasearchGroup belongs to a ReasearchLine. Each Publication can belong to a ReasearchLine and to a ReasearchGroup. My db schema looks like this: research_lines table: id research_groups table: id,research_line_id (references id on...

Routes work in Development But not in Production

ruby-on-rails,routes
Weird Error. I have some routes that work perfectly during development but once i deploy and try to access them it comes up with page does not Exist error I have the following routes.rb file: TransportUnl::Application.routes.draw do resources :trucks resources :shipments do collection do get :autocomplete_location_cs end end devise_for :users...

View from custom controller overriding default view

model-view-controller,controller,routes,orchardcms
I'm using orchardcms 1.9 (no tag created jet). I am writing a custom module that implements its own controller that calles a service wich check some information and based on the service response I either redirect or let the user stay on the page. The module is on the default...

Preserve `$location.search()` in angular `redirectTo`?

javascript,angularjs,routes
How can I preserve $location.search() with $routeProvider.otherwise({redirectTo: xxx}) I know, I can use a function there, which gets the old object $location.search() as the third argument. I mostly care about a single key, let's call it a, and I tried function(a, b, search) { return "/mainpage?a=" + search[a]; } but...

No Route Matches [POST] Bloc

ruby-on-rails,controller,routes
Alright I know there's a million posts on this but I can't seem to find a way to fix mine. I'm new to rails, just starting on my first solo-project after going through a guided one over at bloc. I'm hitting this error: No route matches [POST] "/registered_applications/new" Here are...

Laravel 5 form submit creates an error MethodNotAllowedHttpException

php,forms,controller,routes,laravel-5
I'm using Laravel 5. When editing a form a get this error MethodNotAllowedHttpException There are a few posts but I think it may be code specific. I'd rather not use the resource route methods if possible. Route: Route::get('profile/edit', array('as' => 'admin.profile.edit', 'uses' => [email protected]')); Route::post('profile/edit', array('as' => 'admin.profile.update', 'uses' =>...

Laravel 5 registering a controller to map all methods

php,routes,laravel-5
I am new to Laravel 5 coming from CodeIgniter background. I have habit to not play with routes.php. CodeIgniter automatically maps methods like controllerNAme/MethodName. But in Laravel 5 i am trying to do same by registering a controlller by writing this at top of app/http/sroutes.php Route::controllers([ 'admin/user' => 'Admin\AdminUserController', ]);...

Route Generation error for :create action in Minitest

ruby-on-rails,routes,params,minitest
I am currently writing functional tests for all of my controllers. For every single one, I can't get the create action to work. I keep getting the following error when I run rake test: ActionController::UrlGenerationError: No route matches {:action=>"create", :comment=>{:content=>"I'm a comment.", :product_id=>"685617403"}, :controller=>comments} Here is the action I am...

Another Rails No route matche [Patch]

ruby-on-rails,ruby,routes,blogs,patch
I am trying to edit an article and re-save it. I can create a new article and save that. I can even comment on the article and save that. When I go to edit the article it auto populates the form with the text to be edited but when I...

Reversing controller argument order in routes file fuelphp

php,routes,fuelphp,fuelphp-routing
I am running a fuelphp app with a route that looks like this: 'lastname/:lastname/firstname/:firstname'=> '(@api)/mycontroller/my_method/$2/$1', And then I have a method on my controller like this: public function get_my_method($firstname, $lastname); Unfortunately, what happens is the $firstname variable contains the :lastname passed in from the route, and the the $lastname variable...

Pass array on url using zend framework 2 routes

php,zend-framework,routes,zend-framework2
I have a web app that lets user make multiple searches and show the results of that searches all on the same page. Here's a basic structure: Search 1 - Attribute 1 = X - Attribute 3 = Y Search 2 -Attribute 2 = Z All these results are loaded...

Trying to Delete Message from List with Rails

ruby-on-rails,model-view-controller,routes
So I have a simple list of messages that users can submit. I'm trying to put a delete button (that works) for each message. But as you can see here you get an error about an entirely different action if you click the button. I'm not totally sure about where...

Laravel 4 - Filter results and caching

php,laravel,caching,routes
I am creating an ecommerce system. I have a getCategories() function in a controller. This function works but I tried to extend its functionality so that it would return the appropriate view according to a filter. Lets say the user is viewing a specific category. Each category contains products and...

DaveJamesMiller Breadcrumbs Error - Laravel

laravel,routes,laravel-5,breadcrumbs
I am currently trying to set up breadcrumbs for my Laravel 5 application. Unfortunately, I am currently being presented with this error when I access localhost:8888/auth/login: ErrorException in /Users/ben/Sites/laravel/vendor/davejamesmiller/laravel-breadcrumbs/src/CurrentRoute.php line 29 The current route (GET /auth/login) is not named - please check routes.php for an "as" parameter Routes.php: Route::get('auth/login', 'Auth\[email protected]',...

Codeigniter force all traffic to specific controller and method

php,codeigniter,redirect,routes
I am sorry if this is a duplicate but after hours of searching the interwebs i am drawing up a a blank... I am trying to remove force all traffic to a specific controller and method so my url will read one thing but be another. the end result would...

How should one redirect locale-less URIs to locale-full ones in Symfony-CMF?

php,symfony2,routes,locale,symfony-cmf
Background We have a (fairly typical?) arrangement for a multilingual Symfony CMF website, where resource paths are prefixed by the desired locale—for example: http://www.example.com/en/path/to/english-resource.html; and http://www.example.com/fr/voie/à/ressource-française.html. We are using RoutingAutoBundle to store such routes in the content repository, and DynamicRouter to utilise them: simple and easy. If a GET request...

How to correctly use Express 4 multiple routers

javascript,node.js,express,routes
I'm attempting to use the Express 4 Router to use a different router based on the path. I want all /api/v2/ routes handled by version2, and every other route handled by version1. The below setup serves me all the version1 routes correctly, but seems to ignore version2 as I get...

ActionResult parameter always null

asp.net-mvc,routes
Im trying to define a RouteAttribute in my Controller but the value is always hitting null. Stuff i tried: [HttpGet] [Route("User/ChangePassword/{code:guid}")] public ActionResult ChangePassword(Guid code) { return View(); } URL: http://localhost:59635/User/ChangePassword/c809619-4451-4e60-86ca-3bf7159c6d15 Im getting this code always null, even if i put a string. Ps. The parameter is required and no...