Пример #1
0
func main() {
	rt := goku.RouteTable{Routes: gomenu1.Routes}
	middlewares := []goku.Middlewarer{}
	s := goku.CreateServer(&rt, middlewares, gomenu1.Config)
	goku.Logger().Logln("Server start on", s.Addr)
	log.Fatal(s.ListenAndServe())
}
Пример #2
0
func main() {
	uids := []int64{10011, 10012, 10013}

	_, filename, _, _ := runtime.Caller(0)
	rssConfFile := path.Join(path.Dir(filename), "rss_urls.json")
	rssConf := RssConf{}
	err := utils.LoadJsonFile(rssConfFile, &rssConf.Items)
	if err != nil {
		log.Fatalln("load conf file", rssConfFile, "error:", err.Error())
	}

	// 这个只是为了设置Goku的Log级别,
	// 后面需要重构Goku。
	rt := &goku.RouteTable{Routes: golink.Routes}
	goku.CreateServer(rt, nil, golink.Config)

	for {
		for _, rssItem := range rssConf.Items {
			rssc := crawler.RssCrawler{}
			rssc.Name = rssItem.Name
			rssc.Url = rssItem.Url
			rssc.UserIds = uids
			rssc.Run()
		}
		time.Sleep(time.Minute * 10)
	}
}
Пример #3
0
func main() {
	//	fmt.Println("Hello World!")
	rt := &goku.RouteTable{Routes: gomgoweb.Routes}
	s := goku.CreateServer(rt, nil, gomgoweb.Config)
	goku.Logger().Logln("Server start on", s.Addr)
	log.Fatal(s.ListenAndServe())
}
Пример #4
0
func main() {
	rt := &goku.RouteTable{Routes: gocbweb.Routes}
	s := goku.CreateServer(rt, nil, gocbweb.Config)
	goku.Logger().Logln("Server start on", s.Addr)
	log.Fatal(s.ListenAndServe())

}
Пример #5
0
func main() {

	rt := &goku.RouteTable{Routes: golink.Routes}
	middlewares := []goku.Middlewarer{
		new(middlewares.UtilMiddleware),
		new(middlewares.ConfessMiddleware),
	}
	s := goku.CreateServer(rt, middlewares, golink.Config)
	goku.Logger().Logln("Server start on", s.Addr)

	log.Fatal(s.ListenAndServe())
}
Пример #6
0
func main() {
	/**
	 * set template engine to mustache
	 */
	config.TemplateEnginer = mustache.NewMustacheTemplateEngine()

	rt := &goku.RouteTable{Routes: routes}
	s := goku.CreateServer(rt, nil, config)

	goku.Logger().Logln("Server start on", s.Addr)
	log.Fatal(s.ListenAndServe())
}