A basic application that demonstrates a Python backend with JavaScript frontend integration.
project/
├── myapp/
│ ├── main.py # Main Python application logic
│ └── utils.py # Utility functions for message formatting
└── app.js # Frontend JavaScript code
This simple application provides greeting functionality with timestamp formatting.
-
The Python module (
myapp
) contains the backend logic:main.py
handles user input and greeting generationutils.py
provides helper functions for message formatting and analysis
-
The JavaScript file (
app.js
) simulates a frontend that would interact with the Python backend in a real-world scenario.
Run the Python application from the command line:
cd project
python -m myapp.main
This will prompt you to enter a name and will display a formatted greeting with a timestamp.
To use the frontend, create an HTML file that includes:
<input id="nameInput" placeholder="Enter your name">
<button id="greetButton">Greet</button>
<div id="greetingDisplay"></div>
<script src="app.js"></script>
- Python 3.6+
- Standard library modules only (datetime)
- Web browser with JavaScript enabled (for frontend)