Created
November 1, 2018 10:42
-
-
Save greed2411/3b8efe1bfa33fdc55353b3266eeaaa21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from starlette.applications import Starlette | |
from starlette.responses import PlainTextResponse | |
import uvicorn | |
app = Starlette() | |
@app.route('/') | |
async def homepage(request): | |
return PlainTextResponse('') | |
@app.route('/user/{user_id}') | |
async def user(request): | |
user_id = request.path_params['user_id'] | |
return PlainTextResponse(user_id) | |
@app.route('/user') | |
async def userinfo(request): | |
if request.method == 'POST': | |
return PlainTextResponse('') | |
if __name__ == '__main__': | |
uvicorn.run(app, debug=True, port=3000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment