routes

How to declare a parameter as prefix on OData

北城以北 提交于 2019-12-24 14:03:55
问题 Using a normal ApiController in WebApi, I made the following code to define a dynamic map route template for every ApiControllers: config.Routes.MapHttpRoute( name: "Sample", routeTemplate: "{sessionId}/{controller}" ); I want to achieve a similar behaviour but for every ODataController. I've tried the following code, but it doesn't work: config.MapODataServiceRoute( routeName: "HSODataRoute", routePrefix: "{sessionId}/", model: GetEdmModel()); Any idea how this is made in OData? I'm kinda

JS Sapper : posting data to server (the right way ?)

≡放荡痞女 提交于 2019-12-24 14:02:08
问题 How to properly post data to server using Sapper JS lib ? Saying : I have a page 'board-editor' where I can select/unselect tiles from an hexagonal grid written in SVG, and adds/substract hex coordinates in an store array. Then user fills a form, with board: name, author, and version... Clicking on save button would POST the form data plus the array in store. The server's job, is to store the board definition in a 'static/boards/repository/[name].json' file. Today, there's few details on the

Spring MVC default controller

核能气质少年 提交于 2019-12-24 13:01:16
问题 I have a temporary solution for this and I'll explain it bellow, but I'm looking if there's a better solution. I have a basic Spring 4 MVC app with web.xml configurations (no maven). The web.xml is as follows: <?xml version="1.0" encoding="UTF-8"?> <web-app ...> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener

Dynamic routes on runtime in Rails

喜夏-厌秋 提交于 2019-12-24 12:51:24
问题 I'm developing a site using refinery. Now for one specific page that is created in the back-end of refinery, i want to use my own controller and views. All the User can do with this page is to set the menu-position, title, meta-info etc. The URL for this page has to look the same as all the other pages. So for example, the menu structure looks like: menux menu1 menu2 specific page menux And the URL for "specific page" looks like "locale/menu1/menu2/specific page" The site is available in

AngularJS Dynamic Routes Without Hashtag

倖福魔咒の 提交于 2019-12-24 11:44:22
问题 I am building an application using Angular and not sure how to handle dynamically created urls that do not contain the #. I have tried the html5Mode true but that doesn't work because the server is looking for the actual directory. I want to have an informational homepage for the app that appears when you type in domain.com. A user can create a custom page via an admin app that would be available at domain.com/john. My code below works with hashtags but that creates domain.com/#/ and domain

Rails 3 Resource routing for join models

别来无恙 提交于 2019-12-24 10:38:06
问题 I have a many-to-many relationship between users and teams (as a has_many :through), and I'm trying to setup a "team members" join model as a resource in the routes. In my layouts I've setup a "team context form" that sets a session variable for the current_team , and I want the route for the team_members resources to be defined as /team_members/:user_id/show . Is there any way to do this with the resources :team_members in routes.rb? I've tried using :path_names => {:action => "\some\url"} ,

io.sockets.on not working inside a route in Node.js

拥有回忆 提交于 2019-12-24 09:22:02
问题 I'm trying to use io.sockets.on inside a route in a Node.js and Express app. I have been following what is said here: https://stackoverflow.com/a/31277123/8271839 I can successfully send io.sockets.emit events, but I cannot receive events with io.sockets.on. Here is my code: index.js: const cors = require('cors'); const express = require('express'); const app = express(); const server = require('http').Server(app); const io = require('socket.io')(server); const taskRequest = require('./routes

Rails Can't find route in Functional Test

こ雲淡風輕ζ 提交于 2019-12-24 08:51:30
问题 Rails version 3.0.4 and Ruby 1.9.2 I'm using the devise gem, and have my application set up so that a user must sign in to perform any action. While writing my functional tests, I found that all of the test threw the same error. `method_missing': undefined method `new_user_session_path' This is strange as, if I rake routes I can see new_user_session GET /devise/login(.:format) {:action=>"new", :controller=>"devise/sessions"} I can also confirm that when I run the application, all of the link

http://localhost:4200/#/dashboard, extra '#' in url Angular 5

爷,独闯天下 提交于 2019-12-24 08:47:01
问题 I'm having this issue with an Angular 5 project. All URL using localhost or even when hosted, a '#' is followed after the domain name. Can't find a reason for this. app-routing.module.ts There are children routes for other components const appRoutes: Routes = [ { path: 'login', component: LoginComponent}, { path: 'new-vendor-registration', component: NewVendorComponent}, { path: 'new-vendor-card-add', component: NewVendorCardComponent }, { path: 'forgot-password', component:

CakePHP 2.x Custom Route Pagination

£可爱£侵袭症+ 提交于 2019-12-24 08:34:47
问题 I have a the following custom route (which works fine): Router::connect('/:city', array('controller' => 'dealers', 'action' => 'index'), array('city' => '[a-z]+')); With this route, I am trying to get paginated pages 2, 3, …: Router::connect('/:city/:id', array('controller' => 'dealers', 'action' => 'index'), array( 'pass' => array('city', 'id'), 'city' => '[a-z]+', 'id' => '[0-9]+' ) ); The first problem now is, that if I enter domain.com/washington/2 it doesn't pass the id to Pagination and