This API provides samples to connect with frontend applications in a teaching environment.
You can do a POST to /auth
to obtain a new token.
The body must have:
username
: The usernamepassword
: The password
It returns the following:
{
"expires_in": xxx,
"access_token": {jwt}
}
The expires_in
indicates when the token expired and access_token
are signed with the secret key and will contain the username
.
It returns a String with a Random quote from Chuck Norris. It doesn't require authentication.
It returns a String with a Random quote from Chuck Norris. It requires authentication.
The JWT - access_token
must be sent on the Authorization
header as follows: Authorization: Bearer {jwt}
It returns a List with JSONPlaceholder users. It doesn't require authentication.
Also, you are able to access information about github of three users:
It returns a List with JSONPlaceholder users. It requires authentication.
The JWT - access_token
must be sent on the Authorization
header as follows: Authorization: Bearer {jwt}
Just clone the repository, run npm install
and then npm run start
. That's it :).
If you want to run it on another port, just run PORT=3001 npm run start
to run it on port 3001 for example.