| 
									
										
										
										
											2021-08-26 20:23:55 +03:00
										 |  |  | package controlers | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"net/http" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"github.com/gin-gonic/gin" | 
					
						
							| 
									
										
										
										
											2021-08-28 18:41:34 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	Repositories "micrach/repositories" | 
					
						
							| 
									
										
										
										
											2021-08-26 20:23:55 +03:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func GetThreads(c *gin.Context) { | 
					
						
							| 
									
										
										
										
											2021-08-31 22:10:24 +03:00
										 |  |  | 	threads, err := Repositories.Posts.Get(10, 10) | 
					
						
							| 
									
										
										
										
											2021-08-30 12:09:27 +03:00
										 |  |  | 	if err != nil { | 
					
						
							|  |  |  | 		c.JSON(http.StatusOK, gin.H{"error": true}) | 
					
						
							|  |  |  | 		return | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2021-08-28 18:41:34 +03:00
										 |  |  | 	c.HTML(http.StatusOK, "index.html", threads) | 
					
						
							| 
									
										
										
										
											2021-08-26 20:23:55 +03:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func GetThread(c *gin.Context) { | 
					
						
							|  |  |  | 	c.JSON(http.StatusOK, gin.H{"route": "get thread"}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func CreateThread(c *gin.Context) { | 
					
						
							|  |  |  | 	c.JSON(http.StatusOK, gin.H{"route": "create thread"}) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func UpdateThread(c *gin.Context) { | 
					
						
							|  |  |  | 	c.JSON(http.StatusOK, gin.H{"route": "update thread"}) | 
					
						
							|  |  |  | } |