示例#1
0
文件: web.go 项目: jostly/gophraser
func letterPhraser(res http.ResponseWriter, req *http.Request) {
	vars := mux.Vars(req)
	letter := vars["letter"]
	phrase := response.Phrase{adjectives.OneStartingWith(letter), animals.OneStartingWith(letter)}
	fmt.Fprintln(res, response.BuildResponse(req, phrase, res))
}
示例#2
0
文件: web.go 项目: jostly/gophraser
func randomPhraser(res http.ResponseWriter, req *http.Request) {
	phrase := response.Phrase{adjectives.OneRandom(), animals.OneRandom()}
	fmt.Fprintln(res, response.BuildResponse(req, phrase, res))
}
示例#3
0
文件: web.go 项目: jostly/gophraser
func alliterativePhraser(res http.ResponseWriter, req *http.Request) {
	adj := adjectives.OneRandom()
	phrase := response.Phrase{adj, animals.OneStartingWith(adj[:1])}

	fmt.Fprintln(res, response.BuildResponse(req, phrase, res))
}