You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
639 B
Python
28 lines
639 B
Python
import datetime as dt
|
|
from flask import Blueprint, jsonify
|
|
|
|
from .models import Cookie
|
|
|
|
main_blueprint = Blueprint("main", __name__)
|
|
|
|
__version__ = "1.2.0"
|
|
|
|
|
|
@main_blueprint.route("/ping")
|
|
@main_blueprint.route("/")
|
|
def pong():
|
|
"""A simple ping route."""
|
|
return {"message": "pong"}
|
|
|
|
|
|
@main_blueprint.route("/date")
|
|
def current_date():
|
|
"""A route that simply returns the current datetime of the system"""
|
|
return {"current_date": dt.datetime.now(dt.timezone.utc).isoformat()}
|
|
|
|
|
|
@main_blueprint.route("/cookies")
|
|
def get_cookies():
|
|
cookies = Cookie.query.all()
|
|
return jsonify([cookie.to_dict() for cookie in cookies])
|