/indegother

Indego station + Open Weather Map

Primary LanguagePythonMIT LicenseMIT

Indegother

Indego station + Open Weather Map

CircleCI codecov

Swagger UI demo

  1. Go to this url with token

  2. Click here!

Screen Shot 0003-06-26 at 22 01 07

  1. Set Token

Screen Shot 0003-06-26 at 22 00 45

(For demo server, Token 8cfb7171617589b8e7bd06c328f921a7697133bd)

  1. Enjoy!

Run server for development

Run server

  1. Initial set up
docker-compose build
docker-compose run web python manage.py createsuperuser
docker-compose run web python manage.py drf_create_token <username>
  1. Run server
docker-compose up
  1. Go to http://0.0.0.0:3000/api/schema/swagger-ui/

Tech stacks

  • Python
  • Django / Django REST framework
  • Djongo (Object Document Mapper)
  • MongoDB
  • drf-spectacular (Swagger doc auto generation)

Screen Shot 2021-07-02 at 10 03 32

What I did

  • Requirement clarification (Request volume, ambiguas specification, hosting preference)
  • For minimum requiements
    • Token Authentication
    • Implement 3 endpoints as the challenge describes
    • Use MongoDB with proper indexes and unique constraints
    • Unit tests for mainly validations and Functional tests for APIs (30 tests for 96% coverage)
    • Hosting to an instance of AWS EC2
    • API documentation using Swagger
  • Extras
    • Application-level transaction-like implemenation
    • Return Error codes with custom error classes for front end error handling
    • Page cache for GET 2 endpoints
    • Use Linter auto correct
    • Setup CI(CircleCI for testing, CodeCov for coverage)

Limitations

  • No user registration, no new token generation, no token expiration
  • No database-level transactions (I need to pay for Djongo or implement ODM by myself)
  • Environment variables are hard coded in Dockerfile
  • No proper production server(https, DNS, load-balancing, separated DB servers, logging, monitoring, proper env variables handling, Same/Cross-origin policy, etc...)
  • No deployment automation

Main codes to be reviewed