Skip to content

Jaay7/placementsbackend

Repository files navigation

CI/CD Docker - Django

Placements Backend

Created using Django, GraphQL, and using MongoDB as database.

Accessing the application

1. Clone the application.

2. In the root directory create a virtual environment.

pip install virtualenv
python -m venv venv

3. Now install the packages required for our project which are available in requirements.txt

pip install -r requirements.txt

4. Create a .env file

Naviagte to the placementsbackend folder where settings.py is available

Create a .env file

MONGODB_URI=<YOUR_MONGODB_URI>

5. To run the application

python manage.py makemigrations
python manage.py migrate
python manage.py runserver

6. Testing the application

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
  }
}