Mercurial > cgi-bin > hgwebdir.cgi > POP > oldRepo
annotate 1__Development/6__Website/POPBottleServer/basicServer.py @ 5:e73fbbcb5fd2
Persisting basic graph works, starting to add persist of view hierarchy too
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Sun, 03 Aug 2014 23:38:15 -0700 |
| parents | |
| children |
| rev | line source |
|---|---|
| seanhalle@5 | 1 from bottle import route, run, template, response |
| seanhalle@5 | 2 |
| seanhalle@5 | 3 @route('/hello/<name>') |
| seanhalle@5 | 4 def index(name): |
| seanhalle@5 | 5 return template('<b>Hello {{name}}</b>!', name=name) |
| seanhalle@5 | 6 |
| seanhalle@5 | 7 @route('/savejson/<thejson>') |
| seanhalle@5 | 8 def index(thejson): |
| seanhalle@5 | 9 text_file = open("syntaxGraph.json", "w") |
| seanhalle@5 | 10 text_file.write("%s" % thejson) |
| seanhalle@5 | 11 text_file.close() |
| seanhalle@5 | 12 response.set_header('Access-Control-Allow-Origin', '*') |
| seanhalle@5 | 13 return 'Got JSON!' |
| seanhalle@5 | 14 # return template('Got JSON! {{printjson}}</b>!', printjson = thejson) |
| seanhalle@5 | 15 |
| seanhalle@5 | 16 run(host='localhost', port=8080) |
