Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| package main | |
| import ( | |
| "fmt" | |
| "github.com/fatih/color" | |
| sciter "github.com/sciter-sdk/go-sciter" | |
| "github.com/sciter-sdk/go-sciter/window" | |
| ) |
| // This program is just of learning purpose | |
| // you might have to do modification in file | |
| // to make it production ready | |
| // | |
| // Make sure you have set size of channel and | |
| // part size appropriatly so you machine do | |
| // not crash due to ram overflow | |
| // | |
| // ... |
Look at LSB init scripts for more information.
Copy to /etc/init.d:
# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)| ////////////////////////////// Routes ///////////////////////////////////////// | |
| routes.HandleFunc("/fb/auth",fbHandler) | |
| //This route will process response returned from the facebook Oauth process | |
| routes.HandleFunc("/fb/callback",fbCallbackHandler) | |
| //////////////////////////// FbOauth Handler ////////////////////////////////// | |
| func fbHandler(w http.ResponseWriter, r *http.Request) { |
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| "net/url" | |
| "os" |
| { | |
| "response":{ | |
| "status":{ | |
| "total":1, | |
| "failed":0, | |
| "successful":1 | |
| }, | |
| "request":{ | |
| "query":{ | |
| "match_phrase":"lets" |
| func UnIndexindex1(as string) { | |
| err := index1.Delete(as) | |
| logger.DefaultLogger.Info("unindexing the Entry") | |
| if err!=nil{ | |
| logger.DefaultLogger.Error("Search Module : IndexPublication() "+err.Error()) | |
| } | |
| } |
| func Findindex1(part string) string { | |
| query := bleve.NewMatchPhraseQuery(part) | |
| search := bleve.NewSearchRequest(query) | |
| search.Highlight = bleve.NewHighlight() | |
| searchResults, err := idnex1.Search(search) | |
| if err != nil { | |
| logger.DefaultLogger.Error("Search Module : FindUser() "+err.Error()) | |
| } | |
| return searchResults | |
| } |
| func IndexEntity1(as string, data interface{}) { | |
| err := index1.Index(as, data) | |
| if err!=nil{ | |
| logger.DefaultLogger.Error("Search Module : IndexUser() "+err.Error()) | |
| } | |
| } | |
| func IndexEntity2(as string, data interface{}) { | |
| err := index2.Index(as, data) | |
| if err!=nil{ | |
| logger.DefaultLogger.Error("Search Module : IndexUser() "+err.Error()) |
| func LoadIndex() { | |
| index1, index1Err = bleve.Open("index1.bleve") | |
| index2, index2Err = bleve.Open("index2.bleve") | |
| index3, index3Err = bleve.Open("index3.bleve") | |
| // Check if index1 is exits or not | |
| // If not than create a new one | |
| if index1Err != nil { | |
| // create a new mapping file and create a new index |