Unit Converter is a simple web application that allows users to convert units such as length, weight, and temperature. The app is built using Go Fiber as the web framework and Mustache as the template engine. The sample solution for the unit-converter challenge from roadmap.sh.
- Length Conversion: Millimeter, centimeter, meter, kilometer, inch, foot, yard, mile.
- Weight Conversion: Milligram, gram, kilogram, ounce, pound.
- Temperature Conversion: Celsius, Fahrenheit, Kelvin.
- Simple and responsive user interface.
- Retains results within their respective tabs without reloading the page.
- Programming Language: Go
- Web Framework: Fiber
- Template Engine: Mustache
- UI Interaction & Styling: JS, CSS
Clone this repository to your local directory:
git clone https://github.com/fhasnur/unit-converter.git
cd unit-converterInstall all required dependencies:
go mod tidyRun the application:
go run main.goOpen the application in your browser at:
http://localhost:3000unit-converter/
βββ assets/
β βββ unit-converter.png # Screenshot of the Unit Converter
βββ internal/
β βββ converter/ # Unit conversion logic
β β βββ length.go
β β βββ weight.go
β β βββ temperature.go
β βββ data/
β β βββ units.go # Unit data for display
β βββ handler/
β βββ root.go # Main page handler
βββ templates/
β βββ index.mustache # Main HTML template
βββ static/
β βββ style.css # Styling
β βββ script.js # User interaction logic
βββ .env # Environment variables (for production)
βββ .env.example # Example of environment variables
βββ .gitignore # Files and directories to be ignored by Git
βββ Dockerfile # Docker configuration
βββ railway.json # Railway deployment configuration
βββ go.mod # Go module information
βββ go.sum # Dependency checksum
βββ main.go # Application entry point
βββ README.md # Project documentationContributions are welcome. To contribute, fork this repository, create a new branch, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
