API : first shot
This commit is contained in:
parent
ad461ec477
commit
98247dc94c
11
api/README.md
Normal file
11
api/README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
|
||||
# OpenStreetMap & Ar Redadeg
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
cd api
|
||||
python3 -m venv venv
|
||||
. venv/bin/activate
|
||||
pip install Flask
|
||||
|
28
api/ar-redadeg.py
Normal file
28
api/ar-redadeg.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
import subprocess
|
||||
from subprocess import Popen, PIPE
|
||||
from subprocess import check_output
|
||||
from flask import Flask
|
||||
|
||||
|
||||
def hello():
|
||||
stdout = check_output(['./hello.sh']).decode('utf-8')
|
||||
return stdout
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
|
||||
@app.route('/',methods=['GET',])
|
||||
def home():
|
||||
return '<pre>'+hello()+'</pre>'
|
||||
|
||||
|
||||
@app.route('/phase_1/',methods=['GET',])
|
||||
def phase1():
|
||||
stdout = '<pre>'+check_output(['../scripts/traitements_phase_1.sh']).decode('utf-8')+'</pre>'
|
||||
return stdout
|
||||
|
||||
|
||||
app.run(debug=True)
|
||||
|
7
api/hello.py
Normal file
7
api/hello.py
Normal file
|
@ -0,0 +1,7 @@
|
|||
from flask import Flask
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route('/')
|
||||
def hello_world():
|
||||
return 'Hello, World!'
|
||||
|
3
api/hello.sh
Executable file
3
api/hello.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
echo "hi from shell script"
|
||||
echo "hello from shell script"
|
3
scripts/hello.sh
Executable file
3
scripts/hello.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
echo "hi from shell script"
|
||||
echo "hello from shell script"
|
Loading…
Reference in a new issue