#!/usr/bin/env python
import os
import tornado.ioloop
import tornado.web
import tornado.options

tornado.options.define('cookie_secret', default='sssecccc', help='Change this to a real secret')
tornado.options.define('favicon', default='static/favicon.ico', help='Path to favicon.ico')
tornado.options.define('static_path', default='static/', help='Path static items')
tornado.options.define('port', default=8888, help='Port to run webservice')
tornado.options.define('config', default='server.conf', help='Config file location')

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

    def post(self):
        pass

class ProductHandler(tornado.web.RequestHandler):
    def get(self):
        self.write('[]')

def main():
    tornado.options.parse_command_line()
    options = tornado.options.options
    if os.path.exists(options.config):
        tornado.options.parse_config_file(options.config)

    handlers = [
        (r'/api/products/(.*)', ProductHandler),
        (r'/', MainHandler),
    ]
    settings = {
        'static_path': os.path.join(os.path.dirname(__file__), '..', options.static_path),
        'cookie_secret': options.cookie_secret,
        'login_url': '/login',
        'xsrf_cookies': True,
    }
    application = tornado.web.Application(handlers, **settings)
    application.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()

if __name__ == "__main__":
    main()

@@ -25,16 +25,41 @@
 port os%0A
+import json%0Aimport uuid%0A%0A
 import t
@@ -72,16 +72,16 @@
 .ioloop%0A
-
 import t
@@ -685,16 +685,28 @@
   pass%0A%0A
+cache = %7B%7D%0A%0A
 class Pr
@@ -755,32 +755,40 @@
     def get(self
+, shopid
 ):%0A        self.
@@ -786,23 +786,1287 @@
     
-self.write('%5B%5D'
+if shopid not in cache:%0A            inventory = %7B'pizzas':%0A                    %5B   %7B'id': 1, 'name': 'Pizza lagano', 'price': 45%7D,%0A                        %7B'id': 2, 'name': 'Pizza vegan', 'price': 50%7D,%0A                        %7B'id': 3, 'name': 'Pizza %25s' %25 shopid, 'price': 55%7D,%0A                    %5D,%0A                    'toppings': %5B%0A                        %7B'id': 1, 'name': 'garlic', 'price': 1%7D,%0A                        %7B'id': 2, 'name': 'extra cheese', 'price': 5%7D,%0A                        %7B'id': 3, 'name': 'pepperoni', 'price': 2%7D%0A                     %5D,%0A                    'sizes': %5B%0A                        %7B'id': 28, 'name': '28 cm', 'price': -5%7D,%0A                        %7B'id': 32, 'name': '32 cm', 'price': 0%7D,%0A                        %7B'id': 36, 'name': '36 cm', 'price': 5%7D%0A                        %5D%0A                %7D%0A            cache%5Bshopid%5D = json.dumps(inventory)%0A        self.set_header('Content-Type', 'application/vnd.api+json')%0A        if not self.get_cookie('user'):%0A            self.set_cookie('user', str(uuid.uuid1()))%0A        self.write(cache%5Bshopid%5D)%0A%0A    def post(self, shopid):%0A        if shopid not in cache:%0A            raise tornado.web.HTTPError(404)%0A        self.set_header('Content-Type', 'application/vnd.api+json')%0A        self.write(shopid
 )%0A%0Ad
@@ -2300,11 +2300,15 @@
 ts/(
-.*)
+%5B%5E/%5D+)/
 ', P
@@ -2572,14 +2572,42 @@
 es':
+ False,%0A        'autoreload':
  True
-,
 %0A   

Add minimal support to get products in a jsonapi.org compatible way