| 
					
				 | 
			
			
				@@ -48,6 +48,14 @@ var ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		PathPattern{"/%s/{id}/update", "/%s/%d?format=html&tpl_layout=base&tpl_content=%s_show", []string{"GET", "POST"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		PathPattern{"/%s/{id}/delete", "/%s?format=html&tpl_layout=base&tpl_content=%s", []string{"DELETE"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	jsonPatterns []PathPattern = []PathPattern{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PathPattern{"/api/%s", "", []string{"GET"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PathPattern{"/api/%s/{id}", "", []string{"GET"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PathPattern{"/api/%s/add/", "/%s/%d?format=json&tpl_layout=base&tpl_content=%s_show", []string{"GET", "POST"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PathPattern{"/api/%s/{id}/update", "/%s/%d?format=json&tpl_layout=base&tpl_content=%s_show", []string{"GET", "POST"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		PathPattern{"/api/%s/{id}/delete", "/%s?format=json&tpl_layout=base&tpl_content=%s", []string{"DELETE"}}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 // Generate CRUD handlers 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -57,6 +65,12 @@ func generateHandler(r *mux.Router, base string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+func generateAPIHandler(r *mux.Router, base string) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	for _, pattern := range jsonPatterns { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		r.Handle(fmt.Sprintf(pattern.Path, base), recoverHandler(modelHandler(base, fmt.Sprintf(pattern.Path, base), pattern.RedirectPath))).Methods(pattern.Methods...) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 func Handlers() *mux.Router { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	r := mux.NewRouter() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -75,6 +89,13 @@ func Handlers() *mux.Router { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		generateHandler(r, model) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	for _, model := range []string{"teachers"} { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		generateAPIHandler(r, model) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// // Token handling 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	// r.Handle("/get_token", getToken(db)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	// Static file server 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	r.PathPrefix("/").Handler(http.FileServer(http.Dir("./dist/"))) 
			 |