This commit is contained in:
		
							
								
								
									
										19
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,3 +1,22 @@ | ||||
| # gowebframework | ||||
|  | ||||
| Petit framework web en go pour des petites applications avec chargement des templates et serveur intégré | ||||
|  | ||||
| Le framework se charche de servir les fichiers statiques (url: /static/) et, en mode debug, recharge automatiquement les templates. | ||||
|  | ||||
| Le fichier de configuration est passé dans Configure et doit être au format json avec les paramètres suivants : | ||||
|  | ||||
| ```json | ||||
| { | ||||
| 	"StaticFolderPath": "statics/", | ||||
| 	"TemplateIncludePath": "templates/", | ||||
| 	"TemplateLayoutPath": "templates/layouts/", | ||||
| 	"TemplateExtensionPattern": "*.gohtml", | ||||
| 	"ServerPort": ":8000", | ||||
| 	"Domain": "http://git.an", | ||||
| 	"MainTemplate": "{{define \"main\" }} {{ template \"base\" . }} {{ end }}", | ||||
| 	"Debug": false | ||||
| } | ||||
| ``` | ||||
|  | ||||
| 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. | ||||
|   | ||||
| @@ -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:36:26 | ||||
| * @Last Modified time: 2018-07-14 12:58:10 | ||||
|  */ | ||||
|  | ||||
| package gowebframework | ||||
| @@ -37,6 +37,8 @@ var ServerConfig Config | ||||
| func Configure(config_file_name string, custom_config_file_name string) { | ||||
| 	loadConfiguration(config_file_name, custom_config_file_name) | ||||
| 	loadTemplates() | ||||
| 	// Launch statics server | ||||
| 	http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(ServerConfig.StaticFolderPath)))) | ||||
| } | ||||
|  | ||||
| func loadConfiguration(config_file_name string, custom_config_file_name string) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user