Ascii-art-web is a web application that provides a graphical user interface (GUI) for creating ASCII art banners. The application allows users to input text and select a banner style (shadow, standard, or thinkertoy) to generate an ASCII art banner.
To install, clone the repository locally using Git:
git clone https://learn.zone01kisumu.ke/git/jwambugu/ascii-art-web.git
Alternatively, download the project directly from Gitea and access it through your file manager.
To build and run the application using Docker:
- Build the Docker image:
docker build -t ascii-art-web .
- Run the Docker container:
docker run -d -p 8000:8000 --name ascii-art-web-container ascii-art-web
- Open a web browser at the provided port: http://localhost:8000
The application is implemented in Go programming language. It creates an HTTP server that handles GET and POST requests. HTML templates are used to display data to the user.
- User sends a GET request to the root URL (/) to retrieve the main page.
- Server responds with an HTML template including a text input, radio buttons for banner styles, and a submit button.
- When the form is submitted, the client sends a POST request to /ascii-art endpoint with text and banner style as form data.
- Server processes the request, generates ASCII art banner using the selected style, and responds with an HTML template displaying the banner.
The code is organized into the following directories:
ascii
: contains the ASCII art generationbanner
: contains resources related to banner styleshandlers
: contains server endpoint handlers and related logic for HTTP requests and responses.templates
: contains HTML templates for main page and ASCII art banner display
GET /
: returns the main page HTML templatePOST /ascii-art
: processes form data and generates ASCII art banner
200 OK
: returned when request is successful404 Not Found
: returned when requested resource is not found400 Bad Request
: returned when request is invalid500 Internal Server Error
: returned when an unhandled error occurs
- Application uses Go templates for displaying data to the user.
- Application uses form data to send text and banner style to the server.
- Application uses HTTP server to handle GET and POST requests.