Issue #1: Create Hello World API #4
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.pyc
|
||||
__pycache__/
|
||||
venv/
|
||||
43
README.md
43
README.md
@@ -1,3 +1,44 @@
|
||||
# hello-world
|
||||
|
||||
An empty starter repository for testing Zopu's issue-to-pull-request workflow.
|
||||
---
|
||||
|
||||
## Hello World API
|
||||
|
||||
This repository contains a minimal **Python** Flask application exposing a single endpoint:
|
||||
|
||||
```
|
||||
GET /hello
|
||||
```
|
||||
|
||||
It responds with a short JSON greeting.
|
||||
|
||||
### Quick start
|
||||
|
||||
```bash
|
||||
# install dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# run the server
|
||||
python server.py
|
||||
```
|
||||
|
||||
The service will be available at <http://localhost:5000/hello>.
|
||||
|
||||
### Expected output
|
||||
|
||||
```bash
|
||||
$ curl -s http://localhost:5000/hello
|
||||
{"message":"Hello, world!"}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
> **Note**: No external configuration is required.
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
## Project overview
|
||||
|
||||
This is a simple skeleton used for testing the Zopu issue‑to‑PR workflow. If you wish to report an issue or contribute, feel free to open a pull request.
|
||||
|
||||
1
requirements.txt
Normal file
1
requirements.txt
Normal file
@@ -0,0 +1 @@
|
||||
flask
|
||||
23
server.py
Normal file
23
server.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Simple Hello World API.
|
||||
|
||||
Run with:
|
||||
python3 server.py
|
||||
|
||||
It will start a Flask server listening on http://127.0.0.1:5000/hello
|
||||
|
||||
The endpoint returns JSON:
|
||||
{"message": "Hello, world!"}
|
||||
"""
|
||||
|
||||
from flask import Flask, jsonify
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/hello", methods=["GET"])
|
||||
def hello():
|
||||
return jsonify(message="Hello, world!")
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
||||
Reference in New Issue
Block a user