github.com/uvalib/orcid-access-ws@v0.0.0-20250612130209-7d062dbabf9d/orcidaccessws/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/uvalib/orcid-access-ws/orcidaccessws/config"
     6  	"github.com/uvalib/orcid-access-ws/orcidaccessws/dao"
     7  	"github.com/uvalib/orcid-access-ws/orcidaccessws/handlers"
     8  	"github.com/uvalib/orcid-access-ws/orcidaccessws/logger"
     9  	"log"
    10  	"net/http"
    11  	"time"
    12  )
    13  
    14  func main() {
    15  
    16  	logger.Log(fmt.Sprintf("===> version: '%s' <===", handlers.Version()))
    17  
    18  	// create the storage singleton
    19  	err := dao.NewDatastore()
    20  	if err != nil {
    21  		log.Fatal(err)
    22  	}
    23  
    24  	// setup router and server...
    25  	serviceTimeout := 15 * time.Second
    26  	router := NewRouter()
    27  	server := &http.Server{
    28  		Addr:         fmt.Sprintf(":%s", config.Configuration.ServicePort),
    29  		Handler:      router,
    30  		ReadTimeout:  serviceTimeout,
    31  		WriteTimeout: serviceTimeout,
    32  	}
    33  	log.Fatal(server.ListenAndServe())
    34  }
    35  
    36  //
    37  // end of file
    38  //