Comments (4)
@pepkin88 router.addRoute(/\/articles/, fn)
routes.js supports regular expressions.
from routes.js.
Yes, but then I cannot use named params, which is the key feature for me. Right now I have to perform another check for match if it has trailing slash or not.
So I'm asking, does routes.js have an option to treat trailing slashes strictly? If not, is it considered to be added in the future? In my opinion such option is very relevant to the library.
from routes.js.
Try router.addRoute('/articles$', fn)
That seems to have the correct semantics you want.
from routes.js.
@Raynos Thanks, that works great.
from routes.js.
Related Issues (17)
- routes with N splats HOT 4
- src undefined if fn omitted in addRoute HOT 1
- Request: optional params a la Slim HOT 2
- Request: Parsing querystring HOT 2
- Splats don't match empty string HOT 3
- Matching routes with non-URI characters causes an exception HOT 2
- Splats and params are being transposed HOT 2
- Offer Named Routes and/or Expose routes HOT 3
- matching characters like " HOT 1
- adding multiple handlers for the same path drops the first handler HOT 2
- Global search in regex HOT 1
- `*` in named regular expressions is treated like a wildcard. HOT 1
- Adding routes with the same path causes problems HOT 22
- Query string is blindly sucked into route parameter parsing HOT 2
- publish 2.0.0 to NPM HOT 1
- how to delete a router
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from routes.js.