baltazar
baltazar

Reputation: 57

google app engine api_server vs module

I am developing go api backend using google appengine. When i run the project locally the output says:

INFO 2018-07-11 12:31:17,502 devappserver2.py:120] Skipping SDK update check.
INFO 2018-07-11 12:31:17,576 api_server.py:274] Starting API server at: http://localhost:38628
INFO 2018-07-11 12:31:17,588 dispatcher.py:270] Starting module "default" running at: http://localhost:38629

What is the purpose of two endpoints "API Server" and "module default"? My init is just like this:

http.HandleFunc("/signup", signUp)
http.HandleFunc("/whitelist", whitelist)
http.HandleFunc("/signin", signIn)
http.HandleFunc("/signout", signOut)

Upvotes: 3

Views: 117

Answers (2)

icza
icza

Reputation: 417602

Those 2 "endpoints"–or rather servers–serve different purposes.

First some background:

"An App Engine app is made up of a single application resource that consists of one or more services." (source) Note: Services were previously called "modules".

So an app consists of one or multiple services (or modules). If you don't specify services in your app configuration, there is a default service.

This line:

Starting module "default" running at: http://localhost:38629

tells a web server has been started that will serve the default service (or module), which is the web server you register your handlers to ("/signup", "/whitelist", etc.).

The other server:

Starting API server at: http://localhost:38628

Starts an API server which is not directly used by you. It is an App Engine specific server that acts as a proxy so the local app engine environment can access remote App Engine services (such as Memcache, Datastore) over HTTP. This API server uses the Remote API protocol for communication, and the local dev environment connects to it using HTTP.

You do not need to worry about this API server, and you do not need to configure it or interact with it. It is part of the App Engine local dev environment which aids to access your remote services, those used by your production environment (should you need it).

Upvotes: 1

swigganicks
swigganicks

Reputation: 1231

The default module is the default route into your application. You can check the behavior of your routes in your app.yaml file to see/alter how requests get routed as well in the "handlers" section.

Check out the documentation on how requests are routed for more detailed information.

Upvotes: 1

Related Questions