Exemple #1
0
    database = database

    name = "puppy"
    verbose_name = "Puppy"

    model = PuppyModel
    schema = PuppySchema


app = Flama(
    title="Puppy Register",  # API title
    version="0.1",  # API version
    description="A register of puppies",  # API description
)

app.add_resource("/", PuppyResource)


@app.on_event("startup")
async def startup():
    engine = create_engine(DATABASE_URL)
    metadata.create_all(engine)  # Create the tables.
    await database.connect()


@app.on_event("shutdown")
async def shutdown():
    await database.disconnect()


if __name__ == "__main__":
Exemple #2
0
 def app(self, resource):
     app_ = Flama()
     app_.add_resource("/", resource)
     return app_