typeset-blog/app/views.py

35 lines
857 B
Python

# -*- encoding: utf-8 -*-
"""
Python Aplication Template
Licence: GPLv3
"""
from flask import request
from flask_restless import APIManager
from app import app,db
from models import Post,Paragraph,Comment
# Create the Flask-Restless API manager.
manager = APIManager(app, flask_sqlalchemy_db=db)
# Create API endpoints, which will be available at /api/<tablename> by
# default. Allowed HTTP methods can be specified as well.
manager.create_api(Post, methods=['GET', 'POST', 'DELETE'])
manager.create_api(Paragraph, methods=['GET'])
manager.create_api(Comment, methods=['GET','POST'])
@app.route('/')
def index():
return app.send_static_file('index.html')
#
# @app.route('/api/addpost',methods=['POST'])
# def addpost():
# return 'Post Added'
#
# @app.route('/api/listposts')
# def listposts():
# return 'Post Added'
# ====================