Sometimes we have some situations where we want to share something interesting with someone by sending a link, but we don't want the content to be accessible to all users. Using .htaccess might be a solution in some cases, but for a quicker option that's already integrated into the page, we can utilize some handy features of Qwik
.
This template offers:
- 🔒 A password-protected route. Refer to the example in the
.env.example
file. In the live example, the password to access the main content is msweb. - 🍪 Upon entering the password, a cookie is stored in the browser so that re-entering the password is unnecessary (unless you log out or manually delete your cookies).
To make this template work, just clone/fork/use it as a template, and create a .env.local
out of the .env.example
. I have been using Node 18
without any single problem.