angular 2 app引擎 - 前端后请求到后端

时间:2017-02-22 11:43:07

标签: angularjs google-app-engine angular gae-python27

嗨我有一个角度2应用程序,我想部署到gae。所以后端我使用的是app引擎python。我正在尝试从角度前端到app引擎python做一个简单的发布请求。以下是我的app.yaml

runtime: python27
api_version: 1
threadsafe: true
service: federation-bipedal-hominids

handlers:
- url: /.*
  script: main.app

- url: (.*)/
  static_files: federation-bipedal-hominids/src/app\1/index.html
  upload: app

- url: (.*)
  static_files: app/home\1
  upload: app

main.py

import json
import webapp2
import time


# app = StaticURLParser("federation-bipedal-hominids")

def AsDict():
  return {"Hello World !": "try now"}

class RestHandler(webapp2.RequestHandler):

  def dispatch(self):
    #time.sleep(1)
    super(RestHandler, self).dispatch()


  def SendJson(self, r):
    self.response.headers['content-type'] = 'text/plain'
    self.response.write(json.dumps(r))

class HelloWorld(RestHandler):

  def post(self):

    r = AsDict()
    self.SendJson(r)

class QueryHandler(RestHandler):

  def get(self):

    r = AsDict()
    self.SendJson(r)


app = webapp2.WSGIApplication([


('/HelloWorld', HelloWorld)
], debug=True)

现在,我应该如何从棱角分明的前端做到这一点?

0 个答案:

没有答案