Skip to content

fhasnur/unit-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

22 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Unit Converter

Unit Converter Screenshot

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.

Features

  • 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.

Technologies Used

  • Programming Language: Go
  • Web Framework: Fiber
  • Template Engine: Mustache
  • UI Interaction & Styling: JS, CSS

Installation

Clone this repository to your local directory:

git clone https://github.com/fhasnur/unit-converter.git
cd unit-converter

Install all required dependencies:

go mod tidy

Run the application:

go run main.go

Open the application in your browser at:

http://localhost:3000

Project Structure

unit-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 documentation

Contribution

Contributions are welcome. To contribute, fork this repository, create a new branch, and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

πŸ” Unit Converter, simple web application that allows users to convert units such as length, weight, and temperature.

Topics

Resources

License

Stars

Watchers

Forks

Contributors