blob: bd8303dc93b4dd95f5ae1909d03bd0159a5bdf41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
from bottle import get, post, run, HTTPError
@get("/")
def get_root():
return {"status": "OK"}
@post("/")
def post_root():
return {"status": "SUCCESS"}
@get("/errors/404")
def error_404():
raise HTTPError(404, body={"error": "no exist"})
@get("/errors/500")
def error_500():
raise HTTPError(500, body={"error": "server error"})
run(host="localhost", port=8080)
|