Exemplo n.º 1
0
func main() {
	flag.Parse()
	db, err := sql.Open("postgres", "sslmode=disable user=user port=5432 password=password dbname=database")
	if err != nil {
		log.Fatal("can not connecto to the postgres server:", err)
	}
	log.Println("backend server is starting...")
	server := rpc.NewServer(*host, *port)
	server.Register(&tag.Tag{db})
	server.Register(&content.Content{db})
	server.Register(&test.Test{db})
	server.Register(&user.User{db})
	log.Printf("backend listening %d\n", *port)
	server.Serv()

}
Exemplo n.º 2
0
func main() {
	newServer := oocrpc.NewServer("localhost", 9090)
	newServer.Register(new(Arith))
	newServer.Serv()
}