mekasu0124

Untitled

Feb 17th, 2024
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.79 KB | None | 0 0
  1. import models
  2. import bcrypt
  3.  
  4. from fastapi import FastAPI, HTTPException, Depends, Response
  5. from starlette.middleware import Middleware
  6. from starlette.middleware.cors import CORSMiddleware
  7. from typing import Annotated
  8. from sqlalchemy.orm import Session
  9. from pydantic import BaseModel, Field
  10. from database import SessionLocal, engine
  11.  
  12. cors_middleware = [
  13.     Middleware(
  14.         CORSMiddleware,
  15.         allow_origins=[
  16.             "https://localhost:3000",
  17.             "https://localhost:3001",
  18.             "http://192.168.0.5:3000"
  19.         ],
  20.         allow_credentials=True,
  21.         allow_methods=["*"],
  22.         allow_headers=["*"]
  23.     )
  24. ]
  25.  
  26. app = FastAPI(middleware=cors_middleware)
  27.  
  28. class ProjectBase(BaseModel):
  29.     name: str
  30.     release_date: str
  31.     url: str
  32.     imgur: str
  33.  
  34. @app.get("/")
  35. async def root():
  36.     return { "message": "HelloWorld"}
  37.  
  38. @app.get("/homeText/")
  39. async def home_text():
  40.     parts = [
  41.         "Hi and Welcome to Mek's Hub! Here you can find information",
  42.         "and a download link to all of the programs I have currently released.",
  43.         "All programs come with a menu bar, so if you get stuck or need help",
  44.         "click the Help button at the top of the screen for further assistance.",
  45.         "There are also FAQ pages on each application too which can help answer",
  46.         "most of your questions. The FAQ pages are built from the frequent most",
  47.         "support questions that I receive, so if you don't see your question, then",
  48.         "then feel free to send a support message. If you see your question, but",
  49.         "the solution didn't work for you, please join our discord server and you",
  50.         "can ask your question there as well."
  51.     ]
  52.  
  53.     homeText = " ".join(parts)
  54.  
  55.     print(homeText)
  56.     return { "homeText": homeText}
Advertisement
Add Comment
Please, Sign In to add comment