Designing our web app
The design phase is the most important in any software project as one small mistake in designing becomes very costly to fix that later. In most projects, there are a few solutions applied to mistakes in design, they are just glued together until it becomes impossible to go forward. The term is called technical debt.
Our webapp is going to be a todo list manager for multiple users. It'll have the following features:
The Design
Translating our design to API, we get the following.
URL | Method | Description |
/add/ | POST | add new task |
/ | GET | show pending tasks |
/complete/ | GET | show completed tasks |
/deleted/ | GET | show deleted tasks |
/edit/ | POST | edit post |
/edit/ | GET | show the edit page |
/trash/ | POST | trash post to recycle bin |
/delete/ | POST | permanently delete post |
/complete/ | POST | mark post as complete |
/login/ | POST | do the login |
/login/ | GET | show login page |
/logout/ | POST | log the user out |
/restore/ | POST | restore that task |
/update/ | POST | update task |
/change/ | GET | will allow changing password |
/register/ | GET | show the register page |
/register/ | POST | will add entries into database |
file ~/main/main.go
Create all functions we mentioned above and make the necessary changes as per one definition that we show below in this file.
After you create these functions run the server as below,
In your browser type localhost:8080
and type all these URLs and see what message you get.
Homework
Check the documentation for http.ResponseWriter
and http.Request
objects and get to know all the variables/functions/constants for http package and these two which we mentioned.
Links
Last updated