Comments (3)
Labeling worked :) how do I label paths with "/:name"?
I'd expect "/:name*label" to work, as :name
would consume whatever is consumable.
PATH+METHOD+HOST (if host = "...")?
I considered that earlier, but what makes host really special comparing to all other headers/parameters? Besides, I've seen many cases where HOST is not enough, so the user would still run into the same situation.
I have this peculiarity documented (see the third paragraph here: https://github.com/pkulchenko/fullmoon?tab=readme-ov-file#splat-parameters), but I welcome suggestion on how to make it more prominent.
from fullmoon.
Interesting; can you share the actual values you use and what the host value is when it fails to match? Something like this works for me (and this is in fact what I use in my code):
fm.setRoute({"/*routewww", host = "www.foobar.com"},
function() return fm.serveRedirect(fm.makeUrl{host = "foobar.com"}) end)
fm.setRoute({"/*routeexamples", host = "examples.foobar.com"}, function(r)
r.host = "examples.foobar.co" -- you can reassign the host too for subsequent matches
return false
end)
I suspect what happens is that your second route overwrites the first route, as the route are only unique for PATH+METHOD combination. I thought I had a warning for this, but may need to check. This is why I use *label
at the end of the path to make them distinct.
Suggestion: make the fm.setRoute function find routes using the host parameter as priority
Any filter you specify is going to be applied in exactly the same way, so using the host
header here should work.
from fullmoon.
Interesting; can you share the actual values you use and what the host value is when it fails to match?
-- host 1: dev.convert-2.com:8443 (fail)
fm.setRoute({
host = "dev.convert-2.com",
"/", -- /*convert2
method = "GET"
}, fm.serveContent("/convert-2/luaconvert", {
tools = tools,
categories = categories,
main = main,
title = title,
total = #tools,
year = os.date("%Y")
}))
-- host 2: dev.awesome-awesome.com:8443
fm.setRoute({
host = "dev.awesome-awesome.com",
"/", -- /*awesome
method = "GET"
}, fm.serveContent("/awesome-awesome/index", {}))
This is why I use
*label
at the end of the path to make them distinct.
Labeling worked :) how do I label paths with "/:name"
?
I thought I had a warning for this, but may need to check
PATH+METHOD+HOST (if host = "...")?
Thanks!
from fullmoon.
Related Issues (20)
- Support for multipart/form-data to allow uploading files HOT 10
- serveRedirect parameter order HOT 1
- [Suggestion] Disable Listing HOT 4
- [Suggestion] Built-in DDOS Protection HOT 3
- Processing layouts HOT 6
- multipart form validation HOT 4
- using booleans in oneof rules HOT 2
- In the instructions: "curl -o redbean.com https://justine.lol/redbean/redbean-latest.com" does not work HOT 3
- makeStorage support for in memory database HOT 4
- Does setTemplate support fmg table in lua code directly HOT 9
- Provide DB synchronization HOT 1
- Usage of makeStorage in requests HOT 16
- [Feature Request] To add automatic letsencrypt DNS-01 challenge just like caddy web server HOT 4
- [Feature Request] CSRF protection HOT 2
- call Redbean API functions from template HOT 1
- Reading a cookie that has not been set causes an error HOT 5
- [Feature Request] Grouping variables passed to the template to be passed in the render HOT 2
- How to merge newest changes of Fullmoon, SQLite etc? HOT 2
- A couple of potential bugs HOT 5
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 fullmoon.