mirror of
				https://github.com/gin-gonic/gin.git
				synced 2025-11-04 09:12:12 +08:00 
			
		
		
		
	Fixes code examples in README
This commit is contained in:
		
							parent
							
								
									d6ab48bd1f
								
							
						
					
					
						commit
						120b41fe1d
					
				
							
								
								
									
										18
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								README.md
									
									
									
									
									
								
							@ -61,6 +61,9 @@ func main() {
 | 
				
			|||||||
        message := "Hello "+name
 | 
					        message := "Hello "+name
 | 
				
			||||||
        c.String(200, message)
 | 
					        c.String(200, message)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -167,6 +170,9 @@ func main() {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -195,6 +201,9 @@ func main() {
 | 
				
			|||||||
    r.GET("/someXML", func(c *gin.Context) {
 | 
					    r.GET("/someXML", func(c *gin.Context) {
 | 
				
			||||||
        c.XML(200, gin.H{"message": "hey", "status": 200})
 | 
					        c.XML(200, gin.H{"message": "hey", "status": 200})
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -211,6 +220,9 @@ func main() {
 | 
				
			|||||||
        obj := gin.H{"title": "Main website"}
 | 
					        obj := gin.H{"title": "Main website"}
 | 
				
			||||||
        c.HTML(200, "index.tmpl", obj)
 | 
					        c.HTML(200, "index.tmpl", obj)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -222,6 +234,9 @@ func main() {
 | 
				
			|||||||
    r := gin.Default()
 | 
					    r := gin.Default()
 | 
				
			||||||
    html := template.ParseFiles("file1", "file2")
 | 
					    html := template.ParseFiles("file1", "file2")
 | 
				
			||||||
    r.HTMLTemplates = html
 | 
					    r.HTMLTemplates = html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -256,6 +271,9 @@ func main() {
 | 
				
			|||||||
        // it would print: "12345"
 | 
					        // it would print: "12345"
 | 
				
			||||||
        log.Println(example)
 | 
					        log.Println(example)
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // Listen and server on 0.0.0.0:8080
 | 
				
			||||||
 | 
					    r.Run(":8080")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user