a few examples

This commit is contained in:
2019-06-18 08:51:21 +02:00
parent 3531d493d8
commit 85f1a27e94
4 changed files with 49 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/python3
import cherrypy
import config
import json
static_dir = '/templates/' # Needs to have trailing and leading slash '/'
@@ -8,5 +8,37 @@ class wellcome(object):
'''Base Index constructor and expose function'''
@cherrypy.expose
def index(self):
result = '<h1>Wellcome</h1>'
result = '''{
"firstName": "John",
"lastName": "Smith",
"isAlive": true,
"age": 27,
"address": {
"streetAddress": "21 2nd Street",
"city": "New York",
"state": "NY",
"postalCode": "10021-3100"
},
"phoneNumbers": [
{
"type": "home",
"number": "212 555-1234"
},
{
"type": "office",
"number": "646 555-4567"
},
{
"type": "mobile",
"number": "123 456-7890"
}
],
"children": [],
"spouse": null
}'''
return json.loads(result)
@cherrypy.expose
def other(self):
result = '<h1>Other</h1>'
return result