auth_manual.js
- contains a manual generating and checking JWT token exampleauth_with_lib.js
- contains generating JWT withjsonwebtoken
librarytest_bd.json
- example json, you can remove it and execute real BD get/setserver.js
- express server.env
- contain environment variables:PORT
SECRET_KEY
- used in JWT generation
frontend
:index.html
- index page with login formprivate.html
- private page, you can enter here only if you are logged instyle.css
- some styles
Please download dependencies by
yarn install
yarn dev
- to develop with automatic restart
yarn run
- to production run
- Go to
/
- Login with credentials in
test_bd.json
- Go to
/private-page
and check forprivate-page
not redirect to/
- Create test POST request to
/private-request
with
Authorization: Bearer ${your token from cookies}
and check response
All algorithms are in the comments
Danila, Stavrov