{"id":19756071,"url":"https://github.com/luistar/cgi-to-do-list-with-bash","last_synced_at":"2026-06-04T20:31:28.352Z","repository":{"id":232170313,"uuid":"783624042","full_name":"luistar/cgi-to-do-list-with-bash","owner":"luistar","description":"Example To-do list web application, implemented using Apache HTTPd, CGI, and bash. Fully-containerized.","archived":false,"fork":false,"pushed_at":"2024-04-08T09:48:07.000Z","size":192,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T22:35:59.019Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luistar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-04-08T08:56:01.000Z","updated_at":"2024-04-08T08:58:17.000Z","dependencies_parsed_at":"2024-04-08T11:11:36.652Z","dependency_job_id":null,"html_url":"https://github.com/luistar/cgi-to-do-list-with-bash","commit_stats":null,"previous_names":["luistar/cgi-to-do-list-with-bash"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fcgi-to-do-list-with-bash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fcgi-to-do-list-with-bash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fcgi-to-do-list-with-bash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luistar%2Fcgi-to-do-list-with-bash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luistar","download_url":"https://codeload.github.com/luistar/cgi-to-do-list-with-bash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241086631,"owners_count":19907311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T03:14:38.956Z","updated_at":"2026-06-04T20:31:28.330Z","avatar_url":"https://github.com/luistar.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CGI Example: To-do List with Bash\n\nThis example includes a simple implementation of To-do List Web Application using Apache HTTPd, CGI, and Bash.\n\n## Running this example\n\nRunning this example the easy way requires Docker to be installed on your computer.\nIf you have Docker installed you can simply clone this repository, then run `docker compose up` in the root directory (the one containing the `docker-compose.yml` file). The application will be available at http://localhost:8080.\n\nIf you do not wish to use Docker, you will need to configure your sistem to run bash scripts (e.g.: install bash in a Linux environment, or use WSL). You will also need to install Apache HTTPd (2.4.57 recommended), to use the provided configuration file `httpd.conf`, and to make sure to copy the files included in the `./static` directory into Apache httpd `htdocs` directory (e.g.: `/usr/local/apache2/htdocs/`), and the files included in the `cgi-bin` directory into the Apache httpd `cgi-bin` directory (e.g.: `/usr/local/apache2/cgi-bin/`).\n\n## Overview of the web app\n\nAn overview of the web app is shown in the figure below and described as follows.\n![overview of the web app architecture](image.png)\n\n* `index.html` is a static HTML document. It includes a form, which submits data to the CGI script in `/cgi-bin/save-todo`, and two links to the CGI scripts in `/cgi-bin/list-todo` and `/cgi-bin/reset-todo`.\n* `todo.txt` is the database used by this web app. To-Do items are saved in distinct lines of this text file.\n* `list-todo` is the CGI script responsible for showing the current list of To-Do items. It reads the `todo.txt` files and produces a simple web page with a list as an output.\n* `reset-todo` deletes all content from the `todo.txt` file and shows a simple web page with a confirmation message.\n* `save-todo` receives a POST request made by the form in the static `index.html` file, and adds items to `todo.txt`. This CGI script is slightly more complex than the others.\n  * It inspects the method of the incoming request. If it's not POST, it shows a web page with an error message.\n  * It needs to parse the body of the incoming POST request, which will contain a string of the form `todo=XXX`.\n  * It needs to `url_decode` the value provided by the user. Recall that an input like `Solve P=NP` will be encoded as `Solve%20P%3DNP`, so we need to decode it back. That's what the (cryptic) one-liner (also reported hereafter) at Line 2 of `save-todo` does.\n  ```bash\n  function url_decode() { : \"${*//+/ }\"; echo -e \"${_//%/\\\\x}\"; }\n  ```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluistar%2Fcgi-to-do-list-with-bash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluistar%2Fcgi-to-do-list-with-bash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluistar%2Fcgi-to-do-list-with-bash/lists"}