From The Compiler, 6 Years ago, written in Python.
Embed
  1. import bottle
  2. from bottle import route, request, post
  3.  
  4. bottle.debug(True)
  5.  
  6. @route('/')
  7. def index():
  8.         return '''<form action="/create" method="post">
  9.                        <textarea name="paste" type="text" cols="40" rows="20"></textarea>
  10.                        <input label="blub" type="submit" />
  11.                  </form>'''
  12.  
  13. @route('/view/<pid>')
  14. def show_paste(pid):
  15.         return "Showing paste {}".format(pid)
  16.  
  17. @post('/create')
  18. def create_paste():
  19.         return "You pasted: {}".format(request.forms.get('paste'))
  20.  
  21. bottle.run(host='localhost', port=8081)
  22.