This is entry-task repository for garena. It simulates backend for a game where there will be some user that can register, login, input referral code from another user and many more! Created using django and django redis for caching.
It consist of 6 endpoints
POST /api/register
- User can register to the system by providing
- name
- username
- password
POST /api/login
- User can login and be responded by the jwt token. Just provide matching name and password.
- name
- password
GET /api/heroes
- User can get list of all heroes provided by the game. User also can search the heroes by providing
query params
and will get returned heroes. This endpoint is cached using django-redis-cache
GET /api/find_user
- User can search others username that registered in the system by providing
query params
with search value
POST /api/input_ref
- User can input referral code from others users. This endpoint is protected so only user who have login can access this endpoint
- ref_code
PUT /api/edit_profile
- User can edit their profile by providing the same field from register except password.
- name
- username
- All the field is optional and user only need to provide matching field to change it.
e.g. if user input name field, that means user want to change name attribute
All request and response should be type of applicaton/json
- python
- virtualenv
- django
- django-redis-cache
- pyjwt
- Install python from
https://www.python.org/downloads/
- Clone the repo
git clone https://github.com/IloveNooodles/garena-entry-task.git
- Install virtualenv
pip install virtualenv
- Activate the virtualenv. Please refer to this to activate virtualenv
- Install all requirement
pip install -r requirements.txt
- To run migrations run
python manage.py migrate
- To run the server run
python manage.py runserver