-
-
Save andrewsmedina/6265929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os | |
from nacho.services.servers import NachoServer | |
from nacho.services.routers import Routers | |
from nacho.controllers.base import ApplicationController | |
from tornado.escape import json_encode | |
class MainHandler(ApplicationController): | |
def get(self): | |
data = {'name': 'A Royal Baby', 'body':'A slow news week'} | |
self.finish(json_encode(data)) | |
r = Routers( | |
[ | |
(r"/", MainHandler), | |
], | |
template_path=os.path.join(os.path.dirname(__file__), "views"), | |
) | |
if __name__ == "__main__": | |
r.listen(8888) | |
server = NachoServer() | |
server.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment