在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:clintmod/koa-jwt-login-example开源软件地址:https://github.com/clintmod/koa-jwt-login-example开源编程语言:JavaScript 100.0%开源软件介绍:koa-jwt-login-exampleThis is a quick app to demonstrate how to use koa and koa-jwt to create a secure rest api. This README assumes you're using yarn. If not, you can substitute npm commands where appropriate. Setup
git clone https://github.com/clintmod/koa-jwt-login-example.git
Running the testsYou can run the tests with the usual: yarn test If you want to develop more tests you can run: yarn test-mocha-watch This will start mocha in watch mode. Testing the api
curl -X POST --data '{"username":"thedude", "password":"abides", "email":"[email protected]", "name":"Mr. Lebowski"}' http://localhost:9000/public/register
curl -X POST -H "Content-Type: application/json" --data '{"username":"thedude", "password":"abides"}' http://localhost:9000/public/login
curl -X GET -H "Authorization: Bearer INSERT_TOKEN_HERE" http://localhost:9000/sacred NotesYou'll notice in the I also hash the password using bcrypt because you should always hash your passwords. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论