routing

Does ServiceStack support reverse routing?

柔情痞子 提交于 2019-12-03 07:52:21
Following REST it is advisable that API is discoverable and should be interlinked. Does ServiceStack support any kind of reverse routing? I'm looking for something like Url.RouteLink in ASP MVC. There's some mixed concepts stated here. In and effort of trying to comply with REST you wish to embed URI's in your responses. How best to achieve embedding URI's in your responses. You've assumed a "Reverse Routing" mechanism is how this should be done. REST style vs Strong-typing I want to be explicitly mention here that one doesn't imply the other. On the one hand you're looking to follow a REST

Injecting multi-tenant repositories with StructureMap in ASP.NET MVC

无人久伴 提交于 2019-12-03 07:52:15
问题 I'm implementing StructureMap in a multi-tenant ASP.NET MVC application to inject instances of my tenant repositories that retrieve data based on an ITenantContext interface. The Tenant in question is determined from RouteData in a base controller's OnActionExecuting . How do I tell StructureMap to construct TenantContext(tenantID); where tenantID is derived from my RouteData or some base controller property? Base Controller Given the following route: {tenant}/{controller}/{action}/{id} My

How do i construct a route without ViewContext in ASP.NET MVC?

我怕爱的太早我们不能终老 提交于 2019-12-03 07:46:32
问题 I want to create a route from a utility class that doesn't have access to a ViewContext. Is this possible? There doesnt seem to be any equivalent of ViewContext.Current I've tried fishing around in all the constructors for Routing and HttpContext but can't quite get to what I want. This is what I'm looking for - although this doesn't work because RouteTable.Routes is of type RouteCollection and not RouteData . So close - yet so far :-) RequestContext requestContext = new RequestContext

Call the default asp.net HttpHandler from a custom handler

我的梦境 提交于 2019-12-03 07:28:27
问题 I'm adding ASP.NET routing to an older webforms app. I'm using a custom HttpHandler to process everything. In some situations I would like to map a particular path back to an aspx file, so I need to just pass control back to the default HttpHandler for asp.net. The closest I've gotten is this public void ProcessRequest(HttpContext context) { // .. when we decide to pass it on var handler = new System.Web.UI.Page(); handler.ProcessRequest(context); MemoryStream steam = new MemoryStream();

Node, Express - CANNOT GET route

允我心安 提交于 2019-12-03 07:22:50
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(req, res) { res.render('app/home'); }); module.exports = router; My routes/about.js: - NOT WORKING!

ASP.NET MVC Routing Question

好久不见. 提交于 2019-12-03 07:22:42
问题 I must be dense. After asking several questions on StackOverflow, I am still at a loss when it comes to grasping the new routing engine provided with ASP.NET MVC. I think I've narrowed down the problem to a very simple one, which, if solved, would probably allow me to solve the rest of my routing issues. So here it is: How would you register a route to support a Twitter-like URL for user profiles? www.twitter.com/username Assume the need to also support: the default {controller}/{action}/{id}

Ember.js routing: how do you set a default route to render immediately?

夙愿已清 提交于 2019-12-03 07:15:24
I'm sure this will become clear as I dig in deeper, but for now it's not obvious how to make this happen. I was following the info on this helpful SO article about routing but there is an important piece missing from the example, i.e. how do you get the 'home' view to render right away without having to click the 'home' link? I've started digging into the docs to try to make sense of this, but meanwhile it seems like a useful question to have answered for posterity. I've been playing with the working jsfiddle example from the above question here and comparing with this other example I found

internal/modules/cjs/loader.js:582 throw err

*爱你&永不变心* 提交于 2019-12-03 07:05:34
问题 Recently I started learning Node.js with express. I have tried express router which threw an error. The bigger issue is what caused this and how can I avoid it again. This problem makes me worry and discourages me to learn node.js. Here is the error. What do I need to do? internal/modules/cjs/loader.js:582 throw err; ^ Error: Cannot find module 'C:\Users\User\Desktop\NodeJsProject\app.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15) at Function.Module._load

In Symfony2 how do I redirect within a Controller to a URL with an anchor tag/hash

前提是你 提交于 2019-12-03 07:01:24
问题 I'm in a Controller and I want to redirect back to a URL, say /home/news/example#comment1423 How can I add the hash in to the return params? return $this->redirect( $this->generateUrl("news_view", array("permalink" => "example")) ); 回答1: The simplest solution would probably be concatenation: $url = $this->generateUrl("news_view", array("permalink" => "example")); return $this->redirect( sprintf('%s#%s', $url, 'comment1423') ); 回答2: In Symfony 3.2 you can do this: // generating a URL with a

How to force https for prod but http for dev environment?

只谈情不闲聊 提交于 2019-12-03 06:48:01
问题 I have a symfony2 application. On the prod server I want all my routes to go via https, while in dev I want to be able to use http. How do I achieve that with symfony2 alone? I do not want to touch the webserver configuration. I tried adding this in my routing.yml myBundle: resource: "@MyBundle/Controller/" type: annotation prefix: / schemes: [https] while having this in my routing_dev.yml : myBundle: resource: "@MyBundle/Controller/" type: annotation prefix: / schemes: [http] _main: resource