26
loading...
This website collects cookies to deliver better user experience
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/hello", hello)
log.Fatal(http.ListenAndServe(":8080", nil))
}
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintln(w, "Hello, World!")
}
http.ListenAndServe
when developing applications destined for production, as it does not configure sensible timeout defaults.get "/people/:id" do |env|
id = env.params.url["id"]
first, last = db.query_one "select first_name, last_name from person where id = $1 limit 1", id, as: { String, String }
{"firstName": first, "lastName": last}.to_json
end
input:
kafka:
addresses:
- localhost:9092
topics:
- topic_one
- topic_two
consumer_group: my_benthos_app
output:
cassandra:
addresses:
- localhost:9042
query: INSERT INTO my_keyspace.my_table (id, event, created_at) VALUES (?, ?, ?)
args:
- ${! json("id") }
- ${! json("event") }
- ${! json("timestamp").format_timestamp() }
$ ngrok http 8080
region: ~region~
credentials:
username: ~username~
password: ~password~
brokers:
- broker: ~broker-1~
- broker: ~broker-2~
subnet_cidrs: ~subnet-cidrs~
region: eu-west-1
username: admin
password: supersecret
broker-1:
host: https://localhost
port: 8001
broker-2:
host: https://localhost
port: 8002
subnet-cidrs:
- 1.2.3.0/25
- 1.2.3.128/25
setcfg -i input.yaml -e config.yaml
) will result in the following, which can be piped into a file or a kubectl
command, depending on the type of input file you’re using:brokers:
- broker:
host: https://localhost
port: 8001
- broker:
host: https://localhost
port: 8002
credentials:
password: supersecret
username: admin
region: eu-west-1
subnet_cidrs:
- 1.2.3.0/25
- 1.2.3.128/25