小编tom*_*cht的帖子

如何在Google App Engine中为每个服务绑定一个域/子域?

我发现在GAE中如何将多个域映射到多个服务时遇到很多麻烦。这是配置:

  • Go API是一个应用程序,已在标准环境中部署在GAE中
  • 第二个应用程序是Angular应用程序,它也在标准环境中作为另一项服务部署在GAE中。

这是app.yaml文件:

转到应用程序app.yaml

runtime: go
api_version: go1.9

handlers:
- url: /.*
  script: _go_app
Run Code Online (Sandbox Code Playgroud)

Angular应用程序app.yaml

service: stage
runtime: python27
api_version: 1
threadsafe: true

skip_files:
- ^(?!dist)  # Skip any files not in the dist folder

handlers:
# Routing for bundles to serve directly
- url: /((?:inline|main|polyfills|styles|vendor)\.[a-z0-9]+\.bundle\.js)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*

# Routing for a prod styles.bundle.css to serve directly
- url: /(styles\.[a-z0-9]+\.bundle\.css)
  secure: always
  redirect_http_response_code: 301
  static_files: dist/\1
  upload: dist/.*

# Routing for typedoc, …
Run Code Online (Sandbox Code Playgroud)

google-app-engine google-cloud-platform

4
推荐指数
1
解决办法
1252
查看次数

从Google App Engine连接到MongoDB Atlas

我正在尝试在Google App Engine标准环境中设置API,但我无法连接到远程MongoDB实例.

我在MongoDB Atlas上使用免费的M0群集,所有IP都列入白名单.Google App Engine防火墙规则允许来自所有IP地址的所有流量,以确保不阻止连接请求.

但是,我无法连接到我的Mongo实例,我收到以下错误:

ERROR db_connection querySrv ESERVFAIL <mongo-url>.gcp.mongodb.net

要连接到MongoDB实例,我使用Mongoose并执行以下操作:

const db = await mongoose.connect(uri, { useNewUrlParser: true });

但是db因为我无法连接,所以总是为空.有没有办法从App Engine Standard连接到MongoDB Atlas,还是必须使用Cloud Datastore?

google-app-engine mongodb node.js google-cloud-platform

4
推荐指数
1
解决办法
2069
查看次数

如何在谷歌浏览器中连接到 angular、nodejs http://localhost:4200

我正在关注https://angular.io/cli的教程,但在我的命令提示符下使用命令后,我无法连接到http://localhost:4200ng serve

The page returned the following error: This site can’t provide a secure connection, ERR_SSL_PROTOCOL_ERROR

The project is compiled successfully
Run Code Online (Sandbox Code Playgroud)
  • 我曾尝试允许 nodejs.exe 和 chrome.exe 进入防火墙
  • 我从(设置 -> 高级设置 -> 打开代理设置 -> LAN 设置)禁用了代理服务器
  • 我试过 telnet cmd>telnet localhost 4200 (成功)
  • 我尝试从 Internet Explorer 连接,它工作正常,但网页中没有内容。

以下是按照教程在 windows 命令提示符下执行的:

C:\Users\Ufinity\Desktop\test-angular>ng serve

10% building 3/3 modules 0 activei ?wds?: Project is running at http://localhost:4200/webpack-dev-server/
i ?wds?: webpack output is served from /
i ?wds?: 404s will fallback to …
Run Code Online (Sandbox Code Playgroud)

windows cmd node.js angular

4
推荐指数
1
解决办法
5206
查看次数