github.com/cellofellow/gopkg@v0.0.0-20140722061823-eec0544a62ad/web/examples/multiserver.go (about)

     1  // Copyright 2014 <chaishushan{AT}gmail.com>. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // +build ingore
     6  
     7  package main
     8  
     9  import (
    10  	"github.com/chai2010/gopkg/web"
    11  )
    12  
    13  func hello1(val string) string { return "hello1 " + val }
    14  
    15  func hello2(val string) string { return "hello2 " + val }
    16  
    17  func main() {
    18  	var server1 web.Server
    19  	var server2 web.Server
    20  
    21  	server1.Get("/(.*)", hello1)
    22  	go server1.Run("0.0.0.0:9999")
    23  	server2.Get("/(.*)", hello2)
    24  	go server2.Run("0.0.0.0:8999")
    25  	<-make(chan int)
    26  }