Questions tagged [url-routing]
URL routing lets you configure an application to accept request URLs that do not map to physical files.
133
questions
1
vote
1
answer
81
views
HTTP routing with Mongoose
I'm trying to extend the Mongoose RESTful server example with URL routing.
This code relies on the Mongoose library available here.
This is heavily inspired by the routes class from this question but ...
3
votes
2
answers
140
views
PHP Router For MVC with strict routing requirements
I had previously asked the question here.
The response was pretty much "wow this is bad".
So I learned everything I could and wrote what I believe to be better using TDD.
The strict ...
1
vote
1
answer
288
views
Index.php automatic router for custom MVC
In house we have been building our own MVC framework. One of the things that was important in the project was to not have to add routes manually but instead have a standard and let the index ...
4
votes
1
answer
969
views
NextJS with a root level catchall route for all URLs dynamic middleware that splits into components
Here is the solution that I have. Due to the legacy product we have all of our URLs in one big Slug model in rails that maps URLs to models.
EG
...
2
votes
2
answers
169
views
Router and solid principle
I would like to know if my Routing system respects the solid principle ?
The system is simple, Router class contains the routes and returns the correct route and Route class represents a route, ...
2
votes
1
answer
296
views
Route Improvement in Laravel 8
I have below route. I am using Laravel 8.
...
1
vote
0
answers
67
views
Using HttpServletRequest#getPathInfo or getRequestURI for matching routes in a Router
I'm currently writing on a Router for a MVC framework that will be the core part of my application. The Router is implemented as a Servlet to be registered on any embedded servlet container. In the ...
4
votes
1
answer
312
views
URL router for production
So I've written a URL router which also allows for wildcards (path parameters).
A URL like /users/{uuid} can be added and then, when a user sends a request to the ...
2
votes
0
answers
83
views
implementation of a mvc url router with low coupling and solid principles
i'm building an url router and i want to improve it to respect SOLID principles, i want suggestions of how can i make it less coupled.
here's my current code:
Router.php
...
-1
votes
1
answer
332
views
http router written in Golang
in my jurney to learn Go, I decided to write a simple router which I called it Gouter, which I think it has most of the features in gorilla/mux but in my opinion it's easier to use. Anyway, it ...
2
votes
1
answer
80
views
PHP code for blacklisting and rewriting/redirecting URLs
We faced an issue where URLs had a wrong "subfolder" in its URL, so e.g.
example.com/match1/randomgenerated
should have been
...
0
votes
1
answer
67
views
Improving PHP MVC code for personal website [closed]
Github for project: https://github.com/wrpd/portfolio
I have a very general understanding of MVC but haven't ever implemented it. In an effort to improve my understanding and get back into a little ...
2
votes
1
answer
63
views
Simple Go REST API that returns dummy messages
I am a learner in Go and wrote example below in a day so I would like to get some suggestions to improve it. It is a simple rest api that currently just accepts request and returns a dummy message. My ...
0
votes
0
answers
39
views
WordPress hook to add URL-rewriting rules for articles with language variants
Please look at this working WordPress code:
...
3
votes
0
answers
40
views
Rails route structure for managing tags
I'm hoping someone could vet my route structure as I've really been struggling with getting something that feels right. Right now I have this nested resource structure:
...
4
votes
0
answers
439
views
Simple routing in Rust
After my last attempt, I started to learn Rust again. This time I wrote a simple HTTP router. I would appreciate it if you could help me to fix my mistakes.
Here is the link of the repository
main....
1
vote
0
answers
2k
views
Implementation of Private Route with Auth using react-router and Context API
I'm trying to implement safe routes and checking if the user is authorized using only Context API.
I'm also trying to avoid that the user can see a PrivateRoute, ...
4
votes
2
answers
2k
views
Load other files (from outside public_html) under index.php
I wanted to load every page under index.php with a simple index.php?do=login
For example when the link index.php?do=login or <...
3
votes
0
answers
75
views
Generic router in Rust
I am trying to make a router in Rust using Rocket.rs. I'd like to devise a way to use a default router for my more simple db tables that don't require different logic, to prevent rewriting the same ...
2
votes
1
answer
445
views
Simple MVC built in PHP
I tried to make a MVC in PHP with OOP approach. Code Review this so I can understand whether am I using the best practices and can I legally call it a MVC framework or not. Also, I am going with 1 ...
2
votes
2
answers
80
views
Minimizing duplicate routes index.js
I am trying to build a REST API with express router, which contains of nested sub routes. I have mounted these sub routes in my index.js file.
I have defined it as ...
2
votes
1
answer
279
views
create static page with vuejs
I have a static homepage with some routes and thought about creating this with VueJs. I am totally new to this and just know NodeJs with Handlebars. So normally I would have something like this
<...
4
votes
0
answers
596
views
Client-side routing using Knockout and HTML5 History API for a single-page web application
The full question is... "Please, how can this code base or project (for client-side routing using Knockout and HTML5 History API) be further enhanced as regards security, production-readiness, ES6, ...
2
votes
0
answers
253
views
Python (Sanic) Routing
I wanted to explore how I can associate routes with "controllers" with Sanic as a base. It works fine but "feels" a bit clunky but I can't put my finger on why/how.
routes.py - Returning controller ...
4
votes
1
answer
2k
views
Generating absolute URIs behind a reverse proxy
In my ASP.NET MVC application there are occasions where I need to generate an absolute URI, such as when sending an email confirmation link to a user. The most straightforward approach is to use ...
4
votes
2
answers
99
views
Assigning several variables from request URL using regexes
I refactored some of my code:
Summary: This implementation works with PSGI/Plack. It gets the URL from $env->{PATH_INFO} and assigns a different variable ...
1
vote
1
answer
80
views
Simple routing system
This is my first routing system on PHP. As you can see it's very simple. Any advice or tip about it that can make it better? I want to make it better so I could use it in real websites.
First I ...
1
vote
1
answer
41
views
Node router for marketplace routes
After cleaning up & some refactoring, one module of my code became like below.
However, I'm feeling like there's still some unnecessary redundancy, and it can be improved further and look neater. ...
1
vote
2
answers
54
views
URL Routing Application
In a Ruby on Rails application I want to have this routing:
for URL www.example.com/reports go to controller documents and action ...
3
votes
1
answer
3k
views
Simple PHP Router for home grown MVC framework
I don't know if you guys get tired of seeing a bunch of requests for review of similar projects, but I was really looking for advice.
My website is designed on the MVC pattern. I have a very simple ...
3
votes
1
answer
127
views
Express.js routes management for large web application
I'm currently working on a large web application with numerous routes. Currently, our routes are in one large list in a single JSON file. We recently ran into a problem due to the precedence of ...
1
vote
0
answers
171
views
Very simple RESTful API dispatching in PHP
This code is meant to be a very simple RESTful API.
The simple router takes the URI request and maps it to a function with a matching name. E.g. www.domain.com/bill maps to function bill(). Then bill ...
-2
votes
2
answers
2k
views
Extracting parameters from request URL path components using regexes
The code is not efficient, let's say the url matched in the first regex case but I'm still evaluating second regex for the second case while knowing it's mutually exclusive and only one of them will ...
3
votes
1
answer
67
views
Two java classes with different annotation values only [closed]
Consider two classes:
First
...
3
votes
2
answers
488
views
Simple blog using react redux react-router
I've implemented the logic of my app, but I'm not sure whether it appropriate way or not.
Task: create a react app using redux, react-router v4 which has a page with a form for adding new post and ...
9
votes
1
answer
695
views
A very basic web framework inspired by Flask
I was curious how hard it would be to implement a routing system like flask uses. As it turn's out it's actually not that hard if you understand how decorator's ...
1
vote
1
answer
1k
views
PHP OOP API Class
I want to do an API or contract in Laravel focus when one person wants a contract or credit, but honestly it's for a scholarship but the process it's similar when I got a credit from a bank. Honestly ...
1
vote
0
answers
356
views
PHP - Uri Parser for Routing
I'm trying to build my own PHP MVC framework. I want to implement a routing similar to how ExpressJS/NodeJS implements its routing by making use of Request Handlers.
...
1
vote
1
answer
77
views
PHP code to show a PHP page
I'm trying to avoid manually updating a whitelist of pages, so I wrote the following that I might use, but I'd like my fellow, more experienced, developers to let me know if this is safe. By safe, I ...
1
vote
2
answers
15k
views
PHP Routing with MVC Structure
I'm trying to do a simple CMS with PHP from scratch using MVC structure.
Yesterday I posted this, which is a login system using PHP and it works but it has a handful of problems regarding the OOP ...
3
votes
2
answers
200
views
PHP MVC framework
I am kind of new to MVC, I've read lots of tutorials online but each keep using different approaches so I decided to create mine. Below is what my code looks like.
index
...
1
vote
1
answer
40
views
Dual rewrite rules (WWW prefix and HTTPS)
I want to configure my website to force a www. prefix on the name, and the HTTPS protocol.
...
2
votes
0
answers
774
views
React app with paging
I want to create react app with paging, which will keep state on page reloading.
I'm using react-router-dom and my own Paging ...
4
votes
1
answer
580
views
PHP Dependency Injections w/ Router
I've been working on a personal from-scratch project for the purpose of learning, and so far I've been able to successfully build a DI container and a simple URI router. It works as expected right now,...
5
votes
1
answer
100
views
Defining routes and controllers relationship for given pages
I'm building a CMS app with the help of a custom framework. The back-office is composed of the following pages:
post list
page list
user list
post edit
page edit
user edit
Actually, my routes are ...
8
votes
2
answers
214
views
Node JS routing system
I am doing a website for an association and I have never done the server side before. Here I made a very simple routing system:
...
2
votes
0
answers
187
views
MVC routing with duplicate method entry points
The 3 methods below all need to have the same name: "Roles"
They need to be the same as I have a permissions system that will only allow the execution of a "Roles" method.
I don't feel too happy ...
4
votes
2
answers
122
views
Basic Go HTTP router
I know Gorilla and others have packages that accomplish this, but I'm trying to learn Go by making stuff. In the router below, the first route / is for all http ...
2
votes
2
answers
355
views
PHP Response Wrapper
I'm writing a routing system that may or may not be part of a public API later for a personal project. A main part of the routing system is a response object for the user to send headers, status code, ...
3
votes
1
answer
186
views
Routing System request syntax
I'm working on writing a routing system for a PHP project. I'm trying to write it in a way that it can easily be expanded later on via plugins.
I have 2 ideas for how to go about doing it. I've ...