MCPcopy
hub / github.com/revel/revel / InitServer

Function InitServer

server.go:37–60  ·  view source on GitHub ↗

InitServer initializes the server and returns the handler It can be used as an alternative entry-point if one needs the http handler to be exposed. E.g. to run on multiple addresses and ports or to set custom TLS options.

()

Source from the content-addressed store, hash-verified

35// to be exposed. E.g. to run on multiple addresses and ports or to set custom
36// TLS options.
37func InitServer() {
38 CurrentEngine.Init(ServerEngineInit)
39 initControllerStack()
40 startupHooks.Run()
41
42 // Load templates
43 MainTemplateLoader = NewTemplateLoader(TemplatePaths)
44 if err := MainTemplateLoader.Refresh(); err != nil {
45 serverLogger.Debug("InitServer: Main template loader failed to refresh", "error", err)
46 }
47
48 // The "watch" config variable can turn on and off all watching.
49 // (As a convenient way to control it all together.)
50 if Config.BoolDefault("watch", true) {
51 MainWatcher = NewWatcher()
52 Filters = append([]Filter{WatchFilter}, Filters...)
53 }
54
55 // If desired (or by default), create a watcher for templates and routes.
56 // The watcher calls Refresh() on things on the first request.
57 if MainWatcher != nil && Config.BoolDefault("watch.templates", true) {
58 MainWatcher.Listen(MainTemplateLoader, MainTemplateLoader.paths...)
59 }
60}
61
62// Run the server.
63// This is called from the generated main file.

Callers 2

RunFunction · 0.85
startFakeBookingAppFunction · 0.85

Calls 8

initControllerStackFunction · 0.85
NewTemplateLoaderFunction · 0.85
NewWatcherFunction · 0.85
RunMethod · 0.80
DebugMethod · 0.80
ListenMethod · 0.80
InitMethod · 0.65
RefreshMethod · 0.65

Tested by 1

startFakeBookingAppFunction · 0.68