Reputation: 85
What difference between URL paths:
@app.route('/projects')
@app.route('/projects/')
What does mean slash
in the end of route path? In witch cases to use it?
If I understood correctly it is used for absolute and relative path to server files? Right?
Upvotes: 3
Views: 387
Reputation: 2143
This is called trailing slash.
trailing slash
,https://www.google.com/example/ -> It's a directory.
index.html
https://www.google.com/example -> It's a file.
Therefore, if you specify a trailing slash when requesting a directory resource, there is a small gain in page response speed because you can skip file checking.
@app.route('/projects')
/projects/
-> return 404./projects
-> return 200@app.route('/projects/')
/projects/
-> return 200/projects
-> return 302This article will be helpful.
Upvotes: 1