Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the /_* urls to /_/* #68

Open
j-f1 opened this issue Jun 3, 2017 · 2 comments
Open

Move the /_* urls to /_/* #68

j-f1 opened this issue Jun 3, 2017 · 2 comments

Comments

@j-f1
Copy link

j-f1 commented Jun 3, 2017

This way, you can name your pages however you’d like. Also, there could be a feature where requests to /_/([a-z\d-]+) get require()d from a specific directory in the source code, making it simpler to create separate files for each request.

@relekang
Copy link
Member

relekang commented Jun 5, 2017

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.

@j-f1
Copy link
Author

j-f1 commented Jun 5, 2017

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants