manu-chroma / username-availability-checker

Live at : https://username-check.herokuapp.com/
96 stars 37 forks source link

frontend.py: Add GET method for checking username #23

Closed seeeturtle closed 6 years ago

seeeturtle commented 6 years ago

This GET method returns rendered status.html. This method requires username as variable.

Closes https://github.com/manu-chroma/username-availability-checker/issues/22

manu-chroma commented 6 years ago

Hey @seeeturtle,

That was quick! But with this PR you handle the following route: /<username>. However, according to the issue, we want to return results for the following route /?username=<username>.

For this you need to make changes at: https://github.com/manu-chroma/username-availability-checker/blob/master/frontend.py#L11. Also, have a look at http://flask.pocoo.org/docs/0.12/quickstart/#routing

From the above link:


To access parameters submitted in the URL (?key=value) you can use the args attribute:

searchword = request.args.get('key', '')```
manu-chroma commented 6 years ago

^ check this too: https://stackoverflow.com/questions/24892035/python-flask-how-to-get-parameters-from-a-url

manu-chroma commented 6 years ago

Since checking for username is the special condition, Can you do if username rather than if not username?

I'm pointing out these things just because you can learn from this. I will merge as soon as you make that change!

manu-chroma commented 6 years ago

^ Now that you've understood the issue and how to fix it, you might want to change commit message to something like: frontend.py: Support username query in GET method? (Since, GET method for that route was already present in the code.)