Open j-f1 opened 7 years ago
Thanks for the input. I am not entirely sure what the benefit with /_/([a-z\d-]+)
over /_([a-z\d-]+)
is could you elaborate?
Dynamically requiring files based on user requests might be a bad idea. There is to many corner cases to handle in terms of security. The switch case we have today is not problematic to maintain and is very explicit of what "meta" urls that exist.
@relekang:
I am not entirely sure what the benefit with
/_/([a-z\d-]+)
over/_([a-z\d-]+)
is could you elaborate?
One benefit is that the _
could be changed if you already have a /_realtime
route that you want to track. Another is that /_
could be a help page discussing the project and listing the other “special” pages.
Dynamically requiring files based on user requests might be a bad idea.
That makes sense. I guess you could add an API feature, where a plugin could call <micro-analytics-cli>.register('my-fancy-package', (options, req, res) => {...})
to handle /_/my-fancy-package
with the provided function.
This way, you can name your pages however you’d like. Also, there could be a feature where requests to
/_/([a-z\d-]+)
getrequire()
d from a specific directory in the source code, making it simpler to create separate files for each request.