2
我希望使用Google App Engine在一個應用程序中提供靜態文件和REST請求。在app.yaml中混合腳本和靜態
我用這個的app.yaml
application: test
version: 1
runtime: go
api_version: go1
default_expiration: "7d 5h"
handlers:
- url: /(index.html)?
static_files: static/app/index.html
upload: static/app/index.html
http_headers:
Content-Type: text/html; charset=UTF-8
- url:/
static_dir: static/app/
http_headers:
Vary: Accept-Encoding
- url: /.*
script: _go_app
它適用於靜態文件,但我不能訪問我的腳本。
package main
import (
"fmt"
"net/http"
)
func init() {
http.HandleFunc("/hello_world", handler)
}
func handler(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "Hello, world!")
}
有可能嗎?如果是,我該如何繼續?