routing

dynamic routing for images in laravel

随声附和 提交于 2019-12-12 02:56:33
问题 I have a big deal with image or some features routing in laravel ... for example I have a dashboard page that has @yield('content') ... in dashboard there are some images like logo.png / background-pattern.png & ... . when I get a url for them for example src="assets/img/logo.png" . it's ok for urls like Route::get('/reports' ...) but it doesnt work for Route::get('/report/crete' ...) page . for create page I should give a src like src="../assets/img/logo.png" how can I give the url

Why is my Web API routing being re-routed / falsely routed?

陌路散爱 提交于 2019-12-12 02:55:51
问题 I have two GET methods for a particular Controller / Repository: public IEnumerable<InventoryItem> GetAllInventoryItems() { return inventoryItemsRepository.GetAll(); } [Route("api/{controller}/{ID}/{CountToFetch}")] public IEnumerable<InventoryItem> GetBatchOfInventoryItemsByStartingID(string ID, int CountToFetch) { return inventoryItemsRepository.Get(ID, CountToFetch); } Even though I've tried calling it all these ways from the client, with two arguments: 0) formatargready_uri = string

cakephp 3 parameter url

妖精的绣舞 提交于 2019-12-12 02:53:56
问题 I would like to know how is possible that if someone write a not existent link returns error in cakephp 3. Example: I have an action called test inside controller calle first. Into my routing file I have declared language in this way inside scope : $lang = 'it|en'; $routes->connect('/', ['language' => 'it', 'controller' => 'Pages', 'action' => 'index', 'index'], ['language' => $lang]); $routes->connect( '/:language/:controller', ['action' => 'index'], ['language' => $lang] ); $routes->connect

Nested REST Routing

末鹿安然 提交于 2019-12-12 02:14:52
问题 Simple situation: I have a server with thousands of pictures on it. I want to create a restful business layer which will allow me to add tags (categories) to each picture. That's simple. I also want to get lists of pictures that match a single tag. That's simple too. But now I also want to create a method that accepts a list of tags and which will return only pictures that match all these tags. That's a bit more complex, but I can still do that. The problem is this, however. Say, my rest

asp.net c# app routing

孤人 提交于 2019-12-12 02:08:48
问题 I've been trying to get some routing up and running. I basically want this url: www.example.com/SomebodysName or www.example.com/agents/somebodysname ..to go to... www.example.com/portfolio.aspx?ran=somebodysname I have tried to use an example from MSDN, using globax.asax like this: void Application_Start(object sender, EventArgs e) { RegisterRoutes(System.Web.Routing.RouteTable.Routes); } public static void RegisterRoutes(System.Web.Routing.RouteCollection routes) { routes.MapPageRoute("",

Google App Engine PHP Routing - Query Params

余生颓废 提交于 2019-12-12 01:58:24
问题 My app.yaml looks like: application: skilled-mark-657 version: 1 runtime: php api_version: 1 handlers: - url: /scripts static_dir: scripts - url: /admin?dir=(.*) script: admin.php - url: /admin script: admin.php - url: /admin/delete script: delete.php Then admin.php looks like: <?php $path = str_replace("/admin", '', parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); $_GET['dir'] = $path; var_dump($_GET); When i go to /admin?dir=someFolder I'm redirected back to /admin . I'm trying to have

Third-party router and static files

血红的双手。 提交于 2019-12-12 01:57:39
问题 I'm using a third-party router (httprouter) on Google App Engine and would like to serve static files from root. Because of App Engine, I need to attach the third-party router to the DefaultServeMux on / : router := httprouter.New() // Doesn't work, duplicated "/". http.Handle("/", http.FileServer(http.Dir("public"))) // Needed because of App Engine. http.Handle("/", router) The problem is this duplicates the / pattern and panics with " multiple registrations for / " How can I serve files,

Creating dynamic urls in codeigniter

风流意气都作罢 提交于 2019-12-12 01:57:36
问题 I am currently making a small CMS for a news agency. The admin will update the news in a interval of time. Now I want the url to be look like http://somedomain.com/apple-iphoe5c-released , not like http://somedomain.com/top-news/1 . I have seen in gocart ( built in codeigniter ) , they have the url with the product name . How I am able to achieve this ? 回答1: for this thing you have use the routes in ci which are as given Consider the small example $route['aboutus'] = "any controller is map to

No Route Matches: Missing required [:id] when using nested namespace

别说谁变了你拦得住时间么 提交于 2019-12-12 01:56:11
问题 this is my routes.rb filled with Rails.application.routes.draw do namespace :main, path: ':master_url' do root 'sites#index' namespace :dashboard do root 'dashboards#index' #get 'masters/index' resources :masters end get "/:action" => 'sites#:action' end root 'main/sites#index' end this is command rake routes main_root GET /:master_url(.:format) main/sites#index main_dashboard_root GET /:master_url/dashboard(.:format) main/dashboard/dashboards#index main_dashboard_masters GET /:master_url

Change param name to nested resource parent

≯℡__Kan透↙ 提交于 2019-12-12 01:35:06
问题 I have this routes: resources :tags do resources :comments end so the :create action for the comments has the following form tag_comments POST /tags/:tag_id/comments(.:format) how can i change the paramenter name from :tag_id to :commentable_id ? 回答1: map.tags do resources :comments, :path_prefix => '/tags/:commentable_id' end or via before_filter before_filter :tag2commentable private def tag2commentable params[:commentable_id] = params[:tag_id] unless params[:tag_id].blank? end put it in