uAdmin the Golang Web Framework¶
uAdmin is easy to use, blazing fast and secure. It is a simple yet powerful web framework for building web applications.
Before you proceed to the installation, go over to the Getting Started to see the prerequisite requirements.
Installation¶
$ go get -u -v github.com/uadmin/uadmin/...
To test if your installation is fine, run the uadmin command line:
$ uadmin
Usage: uadmin COMMAND [--src]
This tools helps you prepare a folder for a new project or update static files and templates
Commands:
prepare Generates folders and prepares static and templates
version Shows the version of uAdmin
Get full documentation online:
https://uadmin-docs.readthedocs.io/en/latest/
Your First App¶
Let’s build your first app which is a Todo list. First, we will create a folder for your project and prepare it.
$ mkdir -p ~/go/src/github.com/your_name/todo
$ cd ~/go/src/github.com/your_name/todo
$ uadmin prepare
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/models
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/api
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/views
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/media
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/static
[ OK ] Created: /home/pc_name/go/src/github.com/your_name/todo/templates
Now use your code editor to create main.go and put this code inside it.
package main
import (
"github.com/uadmin/uadmin"
)
func main() {
uadmin.StartServer()
}
Prepare modules
go mod init
go mod tidy
Now to run your code (Linux and Apple macOS):
go build; ./todo
In Windows:
go build & todo
Result:
[ OK ] Initializing DB: [13/13]
[ OK ] Initializing Languages: [185/185]
[ INFO ] Auto generated admin user. Username: admin, Password: admin.
[ OK ] Synching System Settings: [51/51]
[ OK ] Server Started: http://0.0.0.0:8080
___ __ _
__ __/ | ____/ /___ ___ (_)___
/ / / / /| |/ __ / __ __ \/ / __ \
/ /_/ / ___ / /_/ / / / / / / / / / /
\__,_/_/ |_\__,_/_/ /_/ /_/_/_/ /_/
Important
In Windows, you need to use localhost in order to run your application (e.g. http://localhost:8080).
If you go to the explorer, you will notice that there are automatically generated .key and .salt files hidden in your computer.
.key is used for authentication process to assure that the key of the user (“person A” for instance) held by “person B” belongs to the authenticated user which is “person A”.
.salt is extra salt added to password hashing. They add an extra security to your application.
Once they have been deleted, no one can login to your application unless you use the recovery admin account that is automatically generated by your terminal.
Open your browser and go to http://localhost:8080. Then login using “admin” as username and password.
Well done! You have created your first application with the following system models in the uAdmin dashboard.
Go to uAdmin Tutorials section for the continuation.
Update uAdmin to latest version¶
Open your terminal and apply the following commands:
$ cd ~/go/src/github.com/uadmin/uadmin
$ go install
$ uadmin version
[ INFO ] 0.7.4