go_blog

command
v0.0.0-...-c78d268 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2021 License: GPL-2.0 Imports: 7 Imported by: 0

README

context usage

  1. from
  2. source code

为了便于编译,这里我对代码里 import 的路径做了修改。

build & run

# build
go build server.go

# run
go run server.go  

注意:在大天朝,Google 的 API 是无法访问的,自行解决。

Documentation

Overview

The server program issues Google search requests and demonstrates the use of the go.net Context API. It serves on port 8080.

The /search endpoint accepts these query params:

q=the Google search query
timeout=a timeout for the request, in time.Duration format

For example, http://localhost:8080/search?q=golang&timeout=1s serves the first few Google search results for "golang" or a "deadline exceeded" error if the timeout expires.

Directories

Path Synopsis
Package google provides a function to do Google searches using the Google Web Search API.
Package google provides a function to do Google searches using the Google Web Search API.
Package userip provides functions for extracting a user IP address from a request and associating it with a Context.
Package userip provides functions for extracting a user IP address from a request and associating it with a Context.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL