routes

How do unit testing for IgnoreRoute in ASP.NET MVC

元气小坏坏 提交于 2019-12-21 03:59:07
问题 In ASP.NET MVC, I can get information on unit testing for routes and custom routes, but I can not figure out how to do unit testing for IgnoreRoute. routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Practical code is much appreciated. ASP.NET MVC Framework (Part 2): URL Routing ASP.NET MVC Tip #13 – Unit Test Your Custom Routes ASP.NET MVC Tip #30 – Create Custom Route Constraints 回答1: I would check that the RouteHandler on the RouteData for a route matching the ignored path is of type

Where to put a separate admin interface for a Meteor app?

我只是一个虾纸丫 提交于 2019-12-21 03:57:15
问题 I'm trying to build a smart package for Meteor app that provides some monitoring capabilities and other tools based on the features of the smart package. For more details read this question. In any case, I'm trying to figure out the best way to create an admin interface for this package, which will of course be itself running in Meteor. Ideally, I'd like something similar to observatory, except on a separate part of the site that the package can control (or even on a different port.) The way

How to map a route for /News/5 to my news controller

柔情痞子 提交于 2019-12-21 03:38:14
问题 I am trying to identify how to map a route for /News/5 to my news controller. This is my NewsController: public class NewsController : BaseController { // // GET: /News public ActionResult Index(int id) { return View(); } } This is my Global.asax.cs rule: routes.MapRoute( "News", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "News", action = "Index", id = -1 } // Parameter defaults ); I try to go to /News/5 but I receive a resource not found error,

Google Maps v3 Create routes between two points

三世轮回 提交于 2019-12-21 01:50:53
问题 I'm using the Google Maps API to develop a web application. I am trying to create a route between two points but for some reason I haven't figured out how create it. Below is my code, please let me know if there is something I am missing. Thank you. <script> var Center=new google.maps.LatLng(18.210885,-67.140884); var directionsDisplay; var directionsService = new google.maps.DirectionsService(); var map; function initialize() { directionsDisplay = new google.maps.DirectionsRenderer(); var

how to reload routes /config/routes/* in rails 4?

拟墨画扇 提交于 2019-12-20 19:57:29
问题 How to force rails 4 to reload all route files? That is without having to restart the application to make the routes from /config/routes/ .rb get loaded* I did a split them up in /config/routes/ .rb but these /config/routes/ files are not reloaded. This worked in rails 3 but not 4: #config.paths['config/routes'].unshift *Dir["config/routes/*.rb"] 回答1: You can use: Rails.application.reload_routes! You can read about it here (will have to use find ) 回答2: config.paths["config/routes.rb"] << YOUR

How to set class based on current route name/controller

时光毁灭记忆、已成空白 提交于 2019-12-20 16:23:12
问题 Trying to set a class based on my current controller or current route (URL Segment 1). something like <body class="{{controllerName}}"> That way in case I need to target separate pages for CSS specificity, it makes it easy. 回答1: My solution would be: subscribe to route changes at route scope and put name of the controller there: app.run(function($rootScope) { $rootScope.$on('$routeChangeSuccess', function(ev,data) { if (data.$route && data.$route.controller) $rootScope.controller = data.

Create named routes for OmniAuth in Rails 3

故事扮演 提交于 2019-12-20 12:32:22
问题 After having watched Ryan's excellent Railcast Simple OmniAuth, I've managed to implement authentication in my app. Everything is working fine, but in my view I have links that look like this: <%= link_to 'Sign in with Twitter', '/signin/twitter' %> <%= link_to 'Sign in with Facebook', '/signin/facebook' %> I was wondering if there is an elegant way to create a named route to replace that with: <%= link_to 'Sign in with Twitter', signin_twitter_path %> <%= link_to 'Sign in with Facebook',

What is a better way to authenticate some of the routes on Express 4 Router?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-20 10:54:15
问题 I'm using Express 4 where I have a route protected by passport.js, like this: var media = require('express').Router(); media.get('/', function(req, res) { // provide results from db }); media.post('/', passport.authenticate('bearer'), function(req, res) { // This route is auth protected }); So - get collection routes should (mostly) not be protected for me, and create/update routes should. But this requires me to pass passport to all my route files (I have 7 so far), then to add that as a

Manage URL routes in own php framework

末鹿安然 提交于 2019-12-20 09:57:36
问题 I'm creating a PHP Framework and I have some doubts... The framework takes the url in this way: http:/web.com/site/index It takes the first parameter to load controller ( site ) and then loads the specific action ( index ). If you've installed the framework in a base URL works ok, but if you install it in a subfolder like this: http://web.com/mysubfolder/controller/action My script parses it as controller = mysubfolder and action = controller . If you have more subfolders the results will be

A route to serve static assets (like .jpgs, etc?)

我们两清 提交于 2019-12-20 09:56:45
问题 I've worked my way through a number of interesting routing problems - turning a request URL into a hash, etc., but just out of curiosity, is there a way to tell the routing system that you want anything that comes under a certain url subpath to be served literally - without going through a controller? For instance, if I have /home/me/public_html/rails_proj/images/foo.jpg, and .../rails_proj/images/other/bar.jpg, can I insert a route that says "anything under images should just be served as an