Created using Django, GraphQL, and using MongoDB as database.
pip install virtualenv
python -m venv venv
pip install -r requirements.txt
Naviagte to the placementsbackend folder where settings.py is available
Create a .env file
MONGODB_URI=<YOUR_MONGODB_URI>
python manage.py makemigrations
python manage.py migrate
python manage.py runserver
Open postman application to test our endpoint
http://127.0.0.1:8080/graphql/
Make sure your request is set to POST method.
- Register new user
mutation {
registerUser(
email: "<your_email>",
username: "<your_username>",
password: "<your_password>",
fullName: "<your_fullName>
) {
user {
id
email
username
fullName
}
token
}
}
- Login user
mutation {
login(
username: "<your_username>",
password: "<your_password>"
) {
token
payload
}
}
-
Getting the loggedIn user based on token.
In the headers tab give:
KEY as Authorization
VALUES as JWT <your_token>
Make sure there is space between JWT and token
query me {
me {
id
email
username
fullName
}
}