@@ -39,24 +39,24 @@ func main() {
39
39
// Initialize the application
40
40
New ()
41
41
42
- Config.AddConfig (" App" , new (AppConfig)).Load ()
43
-
42
+ Config.AddConfig (" App" , new (AppConfig)).Load ()
43
+
44
44
// artifact.Start() // Database connection will be established here
45
-
46
- Router.GET (" /" , func (c *gin.Context ) {
47
- data := map [string ]interface {}{
48
- " app" : Config.GetString (" App.Name" ),
49
- }
50
-
51
- // or
52
- // data := gin.H{
53
- // "message": "Hello World",
54
- // }
55
-
56
- Res.Status (200 ).
57
- Message (" success" ).
58
- Data (data).Json (c)
59
- })
45
+
46
+ Router.GET (" /" , func (c *gin.Context ) {
47
+ data := map [string ]interface {}{
48
+ " app" : Config.GetString (" App.Name" ),
49
+ }
50
+
51
+ // or
52
+ // data := gin.H{
53
+ // "message": "Hello World",
54
+ // }
55
+
56
+ Res.Status (200 ).
57
+ Message (" success" ).
58
+ Data (data).Json (c)
59
+ })
60
60
61
61
Run ()
62
62
}
@@ -84,7 +84,7 @@ package main
84
84
import " github.com/shipu/artifact/cmd"
85
85
86
86
func main () {
87
- cmd.Execute ()
87
+ cmd.Execute ()
88
88
}
89
89
```
90
90
Run below command to generate crud.
@@ -114,12 +114,12 @@ Suppose your config is `config/db.go`:
114
114
package config
115
115
116
116
type DatabaseConfig struct {
117
- Username string ` mapstructure:"DB_USER" default:""`
118
- Password string ` mapstructure:"DB_PASS" default:""`
119
- Host string ` mapstructure:"DB_HOST" default:""`
120
- Port string ` mapstructure:"DB_PORT" default:""`
121
- Database string ` mapstructure:"DB_DATABASE" default:""`
122
- Connection string ` mapstructure:"DB_CONNECTION" default:""`
117
+ Username string ` mapstructure:"DB_USER" default:""`
118
+ Password string ` mapstructure:"DB_PASS" default:""`
119
+ Host string ` mapstructure:"DB_HOST" default:""`
120
+ Port string ` mapstructure:"DB_PORT" default:""`
121
+ Database string ` mapstructure:"DB_DATABASE" default:""`
122
+ Connection string ` mapstructure:"DB_CONNECTION" default:""`
123
123
}
124
124
```
125
125
and your ` .env ` is:
@@ -205,7 +205,7 @@ data := map[string]interface{}{
205
205
Res.Status (200 ).
206
206
Message (" Success" ).
207
207
Data (data).
208
- Json (c)
208
+ Json (c)
209
209
```
210
210
211
211
` Res ` Api Methods:
0 commit comments