-
create
sample.envfile with dummy credentials[The users can now copy the sample.env file and paste it inside the .env files and replace the placeholders with the required details ]
-
dont use port 5000, use something else
[The ports can now be modified with different port numbers which makes it possible for us to run in any port]
-
find a way for the application to print any problems in MongoDB connection (like bad authentication, connection timeout) without having to test a route for that
-
Don't connect to the database in every module
Hint
Have a separate class that connects for you and returns the db object or the collections object to where ever you import (that class) and use it
- Everyone
url_prefixs like @PreethiCodes @./modules/app_admin.py:19 -
modules/app_shorten.py:62andmodules/app_analytics.py:25both does 1 thing similar - returing full url given shortcode. I insist that onlymodules/app_shorten.py:62returns URL and callsmodules/app_analytics.py:25itself.
Hint
Use internal API Calls
-
./modules/app_analytics.pyhas following changes - CH1, CH2, CH3 -
./modules/app_bs.pyhas following changes - CH4 -
./modules/app_shorten.pyhas following changes - CH5, CH6, CH7
Note
All CH identifiers are included in comments on the relevant lines describing the required changes. Use Ctrl+Shift+F (Windows/Linux) or Cmd+Shift+F (macOS) to search for a specific CH number and quickly navigate to it.
- Every single record under
click_datain the database has Unknown forcountry,region,city. Find out why and try to have the backend register some actual data there, like 'Coimbatore, IN`
Let's see who can figure this out first. If you are the one, mark it as completed and give an explaination below. Attach any relevant images if required.
I'll drop a hint on Wednesday
Hint
Wait till Wednesday :))
[Hi, Subha here Explanation: All the IP addresses recorded are 127.0.0.1 which is localhost (loopback). Since the request is being made from the computer to the computer itself it loops back and does not go out to the public internet (so no public IP). How to fix this? We can go through external tunneling service while making the request. For example, I used ngrok. So while making a request using ngrok’s public URL instead of localhost, it goes through ngrok’s servers first. This makes it seem like an actual external request. (If you check the database for the shortCode:ZJiUAQ, https://www.subhatesting.com, under click_data, objects 13,14,15,16 have this: ip:"49.47.217.189",country:"India", region:"Tamil Nadu", city:"Coimbatore")
so basically:
initially: Postman --> Flask (on the same Computer) now: Postman --> ngrok --> Flask sees a public IP from the X-Forwarded-For header]
- Write test scripts. You will define what function/route to test, the sample input and expected output. It checks if the function/route returns the expected output (P.S it's called Black Box Testing)
- Try to plug it into GitHub Actions such that whenever someone pushes to backend / makes a pull request, it checks if all functions/routes are still sane
I'll drop a hint on Wednesday
Hint
Wait till Wednesday :))
Note
We will try having next week's todo's in GitHub Issues. It's better in so many ways