diff --git a/README.md b/README.md index 032419a..1f98667 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,5 @@ Le fichier de configuration est passé dans Configure et doit être au format js ``` Le MainTemplate est utilisé pour charger tous les templates, il peut être utilisé tel quel ou modifié si vous savez ce que fous faites. Dans le doute, laissez celui par défaut. + +On lance enfin le serveur en utilisant Start() diff --git a/gowebframework.go b/gowebframework.go index a2769af..e100e37 100644 --- a/gowebframework.go +++ b/gowebframework.go @@ -2,7 +2,7 @@ * @Author: Bartuccio Antoine * @Date: 2018-07-14 11:32:11 * @Last Modified by: klmp200 -* @Last Modified time: 2018-07-14 12:58:10 +* @Last Modified time: 2018-07-14 13:01:20 */ package gowebframework @@ -34,11 +34,17 @@ type Config struct { var ServerConfig Config +// Load templates and configuration func Configure(config_file_name string, custom_config_file_name string) { loadConfiguration(config_file_name, custom_config_file_name) loadTemplates() - // Launch statics server +} + +// Starts server +func Start() { http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(ServerConfig.StaticFolderPath)))) + log.Println("Server listening on http://localhost" + ServerConfig.ServerPort) + log.Fatal(http.ListenAndServe(ServerConfig.ServerPort, nil)) } func loadConfiguration(config_file_name string, custom_config_file_name string) {