21 lines
No EOL
561 B
Python
21 lines
No EOL
561 B
Python
from nexios import NexiosApp
|
|
import uvicorn
|
|
|
|
# Create a new Nexios application
|
|
app = NexiosApp()
|
|
|
|
# Define a simple route
|
|
@app.get("/")
|
|
async def hello_world(request, response):
|
|
return response.json({
|
|
"message": "Hello from Nexios!",
|
|
"status": "success"
|
|
})
|
|
|
|
# If you forget to use async def for your handler, Nexios will run the handler in a threadpool
|
|
|
|
# If you define two routes with the same path and method, Nexios will raise a conflict error at startup.
|
|
|
|
# Run the application
|
|
if __name__ == "__main__":
|
|
uvicorn.run("main:app") |