Skip to content

Commit 9309ace

Browse files
author
chenhg5
committed
update
1 parent 02db5aa commit 9309ace

File tree

1 file changed

+5
-108
lines changed

1 file changed

+5
-108
lines changed

README.md

+5-108
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@ GoAdmin is a toolkit to help you build a data visualization admin panel for your
3737

3838
Online demo: [https://demo.go-admin.com](https://demo.go-admin.com)
3939

40-
Quick follow up example:
41-
42-
- [pure golang](https://github.com/GoAdminGroup/example), simple and less dependency
43-
- [golang with frontend template](https://github.com/GoAdminGroup/example_with_frontend), change template by yourself
44-
- [golang with vue](https://github.com/GoAdminGroup/example_with_vue), if you have vue experience
45-
4640
![interface](http://file.go-admin.cn/introduction/interface_en_3.png)
4741

4842
## Features
@@ -70,110 +64,13 @@ $ go install github.com/GoAdminGroup/adm@latest
7064
$ adm init web
7165
```
7266

73-
### Step 1: import sql
74-
75-
- [mysql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql)
76-
- [mssql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.mssql)
77-
- [postgresql](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.pgsql)
78-
- [sqlite](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.db)
79-
- [OceanBase](https://raw.githubusercontent.com/GoAdminGroup/go-admin/master/data/admin.sql)
80-
81-
82-
### Step 2: create main.go
83-
84-
<details><summary>main.go</summary>
85-
<p>
86-
87-
```go
88-
package main
89-
90-
import (
91-
"github.com/gin-gonic/gin"
92-
_ "github.com/GoAdminGroup/go-admin/adapter/gin"
93-
_ "github.com/GoAdminGroup/go-admin/modules/db/drivers/mysql"
94-
"github.com/GoAdminGroup/go-admin/engine"
95-
"github.com/GoAdminGroup/go-admin/plugins/admin"
96-
"github.com/GoAdminGroup/go-admin/modules/config"
97-
"github.com/GoAdminGroup/themes/adminlte"
98-
"github.com/GoAdminGroup/go-admin/template"
99-
"github.com/GoAdminGroup/go-admin/template/chartjs"
100-
"github.com/GoAdminGroup/go-admin/template/types"
101-
"github.com/GoAdminGroup/go-admin/examples/datamodel"
102-
"github.com/GoAdminGroup/go-admin/modules/language"
103-
)
104-
105-
func main() {
106-
r := gin.Default()
107-
108-
eng := engine.Default()
109-
110-
// global config
111-
cfg := config.Config{
112-
Databases: config.DatabaseList{
113-
"default": {
114-
Host: "127.0.0.1",
115-
Port: "3306",
116-
User: "root",
117-
Pwd: "root",
118-
Name: "goadmin",
119-
MaxIdleConns: 50,
120-
MaxOpenConns: 150,
121-
ConnMaxLifetime: time.Hour,
122-
Driver: "mysql",
123-
},
124-
},
125-
UrlPrefix: "admin",
126-
// STORE is important. And the directory should has permission to write.
127-
Store: config.Store{
128-
Path: "./uploads",
129-
Prefix: "uploads",
130-
},
131-
Language: language.EN,
132-
// debug mode
133-
Debug: true,
134-
// log file absolute path
135-
InfoLogPath: "/var/logs/info.log",
136-
AccessLogPath: "/var/logs/access.log",
137-
ErrorLogPath: "/var/logs/error.log",
138-
ColorScheme: adminlte.ColorschemeSkinBlack,
139-
}
140-
141-
// add component chartjs
142-
template.AddComp(chartjs.NewChart())
143-
144-
_ = eng.AddConfig(&cfg).
145-
AddGenerators(datamodel.Generators).
146-
// add generator, first parameter is the url prefix of table when visit.
147-
// example:
148-
//
149-
// "user" => http://localhost:9033/admin/info/user
150-
//
151-
AddGenerator("user", datamodel.GetUserTable).
152-
Use(r)
153-
154-
// customize your pages
155-
eng.HTML("GET", "/admin", datamodel.GetContent)
156-
157-
_ = r.Run(":9033")
158-
}
159-
```
160-
161-
</p>
162-
</details>
163-
164-
More framework examples: [https://github.com/GoAdminGroup/go-admin/tree/master/examples](https://github.com/GoAdminGroup/go-admin/tree/master/examples)
67+
## Example
16568

166-
### Step 3: run
167-
168-
```shell
169-
GO111MODULE=on go run main.go
170-
```
171-
172-
visit: [http://localhost:9033/admin](http://localhost:9033/admin)
173-
174-
account: admin password: admin
69+
Quick follow up example:
17570

176-
[A super simple example here](https://github.com/GoAdminGroup/example)
71+
- [pure golang](https://github.com/GoAdminGroup/example), simple and less dependency
72+
- [golang with frontend template](https://github.com/GoAdminGroup/example_with_frontend), change template by yourself
73+
- [golang with vue](https://github.com/GoAdminGroup/example_with_vue), if you have vue experience
17774

17875
See the [docs](https://book.go-admin.cn) for more details.
17976

0 commit comments

Comments
 (0)