A simple Morse Code Translator/Generator built with a lightweight Java backend and a clean HTML/JS frontend. The project allows you to:
- Convert plain text → Morse code
- Convert Morse code → plain text
- Interact through a minimal web interface (
index.html) - Or use REST endpoints (
/encode,/decode) programmatically
-
Backend: Java
HttpServer(no external dependencies)POST /encode→ Returns Morse code for given textPOST /decode→ Returns plain text for given Morse code
-
Frontend: Responsive HTML + CSS + Vanilla JS interface
-
CORS enabled → Works with separate frontend file
-
Clean UI with support for letters, numbers, and
/as word separator
-
Clone the repo:
git clone https://github.com/your-username/morse-code-translator.git cd morse-code-translator -
Compile and run the backend:
javac MorseCodeServer.java java MorseCodeServer
Server runs on http://localhost:8081/
-
Open
index.htmlin your browser.- Type plain text and click Encode →
- Paste Morse and click ← Decode
Example using curl:
# Encode text
curl -X POST http://localhost:8081/encode -d "HELLO WORLD"
# Decode Morse
curl -X POST http://localhost:8081/decode -d ".... . .-.. .-.. --- / .-- --- .-. .-.. -.."├── MorseCodeServer.java # Java backend (API server)
└── index.html # Frontend UI
- Add support for punctuation
- Play Morse code as audio beeps
- Deployable as a lightweight web app
This project is open-source under the MIT License.