forked from LandmakTechnology/python-flask-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
34 lines (23 loc) · 786 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from flask import Flask, request
from app_service import AppService
import json
app = Flask(__name__)
appService = AppService();
@app.route('/')
def home():
return "The Python Application is Working and ready for deployment!!!"
@app.route('/api/tasks')
def tasks():
return appService.get_tasks()
@app.route('/api/task', methods=['POST'])
def create_task():
request_data = request.get_json()
task = request_data['task']
return appService.create_task(task)
@app.route('/api/task', methods=['PUT'])
def update_task():
request_data = request.get_json()
return appService.update_task(request_data['task'])
@app.route('/api/task/<int:id>', methods=['DELETE'])
def delete_task(id):
return appService.delete_task(id)