// Create a core of the web framework with everything pre-configured for development. func NewSimpleCore() *Core { var enigma = yotsuba.Enigma{} var router = NewRouter() var actualCacheDriver = yotsuba.NewInMemoryCacheDriver(&enigma, false) var castedCacheDriver = yotsuba.CacheDriver(actualCacheDriver) return NewCore( router, &castedCacheDriver, &enigma, false, ) }
func StartService( address string, cachePath string, metadataPath string, debugMode bool, ) { cryptographer := yotsuba.Enigma{} memoryCacheDriver := yotsuba.NewInMemoryCacheDriver(&cryptographer, !debugMode) cacheDriver := yotsuba.CacheDriver(memoryCacheDriver) fetcherService := NewFetcher( &cryptographer, cachePath, metadataPath, true, ) app := Application{ CacheDriver: cacheDriver, Cryptographer: cryptographer, FetcherService: fetcherService, } core := tori.NewSimpleCore() core.Router.DebugMode = debugMode core.Router.PriorityList.DebugMode = debugMode core.Router.OnGet( "image-default", "/i/<destination>", app.HandleImage, true, ) core.Router.OnGet( "image-default", "/i/<destination>/<spec>", app.HandleImage, true, ) core.Listen(&address) }