API : test.sh route

This commit is contained in:
MaelREBOUX 2021-04-05 23:22:05 +02:00
parent 3ad462c1bd
commit 1987ec05bc
2 changed files with 15 additions and 0 deletions

View file

@ -3,6 +3,12 @@
from flask import Flask
import subprocess
from subprocess import Popen, PIPE
from subprocess import check_output
app = Flask(__name__)
@ -12,6 +18,13 @@ def index():
return "<h1 style='color:blue'>Ar Redadeg API</h1>"
pass
@app.route("/test/")
def test():
stdout = check_output(['./test.sh']).decode('utf-8')
return stdout
@app.route("/about/")
def about():
return "This is a simple Flask Python application"

2
api/test.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/bash
echo "hello from shell script"