Skip to content

Doing awesome stuffs with rust and rocket learning, like jwt authorization / login, create and retrieve data from mongodb

Notifications You must be signed in to change notification settings

joaoneto/hello-rocket

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Run

docker-compose up

To execute with cargo, need to set some env vars before:

APP_ENV=development \
APP_PORT=8000 \
APP_DB=app \
MONGODB_URL=mongodb://localhost:27017 \
USER_TOKEN_SALT=SECRET_USER_SALT \
cargo-run

Register user

curl --request POST \
  --url http://localhost:8000/users/register \
  --header 'Content-Type: application/json' \
  --data '{
	"name": "João",
	"password": "123",
	"email": "[email protected]"
}'

Login

curl --request POST \
  --url http://localhost:8000/login \
  --header 'Content-Type: application/json' \
  --data '{
	"email": "[email protected]",
	"password": "123"
}'

List users

curl --request GET \
  --url http://localhost:8000/users \
  --header 'Authorization: Bearer PASTE_THE_LOGIN_TOKEN_HERE'

About

Doing awesome stuffs with rust and rocket learning, like jwt authorization / login, create and retrieve data from mongodb

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published