Пример #1
0
from handler.scholar import routes as scholar_routes
from handler.scholar_app import routes as scholar_app_routes
from handler.sponsor_app import routes as sponsor_app_routes
from handler.board import routes as board_routes

from core.router import Router
from flask import Flask
from flask_cors import CORS

app = Flask(__name__)
CORS(app)
router = Router(app)

router.get('/', lambda: 'Hello World!')
router.group('/scholar', scholar_routes)
router.group('/scholar_app', scholar_app_routes)
router.group('/sponsor_app', sponsor_app_routes)
router.group('/board', board_routes)

if __name__ == '__main__':
    router.execute()
    app.run(port=8888)
Пример #2
0
from endpoint import endpoints
from chat_socket.chat import chat_server_start

app = Flask(__name__)
CORS(app)
router = Router(app)
load_dotenv()


@app.before_request
def before():
    if db.is_closed():
        db.connect()


@app.after_request
def after(req):
    if not db.is_closed():
        db.close()

    return req


for group_name, group_endpoints in endpoints.items():
    router.group(group_name, group_endpoints)

if __name__ == "__main__":
    thread = Thread(target=chat_server_start)
    thread.start()
    router.start()
Пример #3
0
from core.router import Router
from src.route.user import user_router
from src.route.category import category_router
from src.route.routine import routine_router
from src.route.event import event_router
from src.route.activity import activity_router
from src.route.location import location_router
from src.route.schedule import schedule_router

group_router = Router()
group_router.group("/user", user_router)
group_router.group("/category", category_router)
group_router.group("/routine", routine_router)
group_router.group("/event", event_router)
group_router.group("/activity", activity_router)
group_router.group("/location", location_router)
group_router.group("/schedule", schedule_router)

__all__ = [group_router]