Skip to content
This repository was archived by the owner on Oct 15, 2023. It is now read-only.

Commit e179435

Browse files
authored
Update README.md
1 parent 4ed2827 commit e179435

File tree

1 file changed

+54
-51
lines changed

1 file changed

+54
-51
lines changed

README.md

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -36,60 +36,62 @@ Then the Go api is being developed and customized by you together with the front
3636

3737
## How to use (with go get)
3838
first run the following in CMD (with go installed) <br><br>
39-
<code>go get github.com/lmbek/gobek</code><br><br>
39+
The Go package:
40+
41+
go get github.com/lmbek/gobek
42+
<br><br>
4043
Example: how to add framework to main.go<br>
41-
<pre>
42-
//go:generate ./bin/windows/go-packager/GoPackager.exe
43-
// go generate
44-
// go build -ldflags -H=windowsgui -o NewProjectName.exe
45-
46-
// ** Generating and Building **
47-
// The above is the generate commands to add icon and manifest to binary,
48-
// and the build command
49-
// NOTE: GoPackager.exe is a modified version of goversioninfo (https://github.com/josephspurrier/goversioninfo).
50-
// You can compile your own GoPackager.exe at ./bin/windows/go-packager by go building the main.go file
51-
52-
// ** Reason Of Framework Explained **
53-
// This application is meant to find a port and launch a frontend in chrome (windows) or chromium (linux).
54-
// Meanwhile, it will open a http localhost backend with an api.
55-
// The API package at ./backend/api/ can be replaced to fit another application,
56-
// if the framework is to be used for other applications.
57-
// It is important to note, that the system will require a frontend directory and a data directory,
58-
// when the application is tested and released, these will also need to be managed (other applications can be put in)
59-
// This framework is very open-source, since when released to users, the users can modify the frontend files.
60-
// However, the backend can be kept as binary, but sent to users if they later want to modify it,
61-
// for example users must be able to modify the application backend, and replace the binary with the modified version.
62-
63-
package main
64-
65-
import (
66-
"fmt"
67-
"github.com/lmbek/gobek"
68-
"os"
69-
)
70-
71-
// For windows, we need an organisation name and project name
72-
var organisationName = "NewOrganisationName" // put in organisation name
73-
var projectName = "NewProjectName" // put in project name
74-
var chromeLauncher = gobek.ChromeLauncher{
75-
Location: os.Getenv("programfiles") + "\\Google\\Chrome\\Application\\chrome.exe",
76-
FrontendInstallLocation: os.Getenv("localappdata") + "\\Google\\Chrome\\InstalledApps\\" + organisationName + "\\" + projectName,
77-
}
78-
var chromiumLauncher = gobek.ChromiumLauncher{
79-
Location: "/var/lib/snapd/desktop/applications/chromium_chromium.desktop",
80-
}
81-
var frontendPath = "./frontend" // this should be set to where frontend files is (frontend folder: html, css, javascript...)
82-
func main() {
83-
err := gobek.StartDefault(frontendPath, chromeLauncher, chromiumLauncher)
84-
if err != nil {
85-
fmt.Println(err)
44+
45+
//go:generate ./bin/windows/go-packager/GoPackager.exe
46+
// go generate
47+
// go build -ldflags -H=windowsgui -o NewProjectName.exe
48+
49+
// ** Generating and Building **
50+
// The above is the generate commands to add icon and manifest to binary,
51+
// and the build command
52+
// NOTE: GoPackager.exe is a modified version of goversioninfo (https://github.com/josephspurrier/goversioninfo).
53+
// You can compile your own GoPackager.exe at ./bin/windows/go-packager by go building the main.go file
54+
55+
// ** Reason Of Framework Explained **
56+
// This application is meant to find a port and launch a frontend in chrome (windows) or chromium (linux).
57+
// Meanwhile, it will open a http localhost backend with an api.
58+
// The API package at ./backend/api/ can be replaced to fit another application,
59+
// if the framework is to be used for other applications.
60+
// It is important to note, that the system will require a frontend directory and a data directory,
61+
// when the application is tested and released, these will also need to be managed (other applications can be put in)
62+
// This framework is very open-source, since when released to users, the users can modify the frontend files.
63+
// However, the backend can be kept as binary, but sent to users if they later want to modify it,
64+
// for example users must be able to modify the application backend, and replace the binary with the modified version.
65+
66+
package main
67+
68+
import (
69+
"fmt"
70+
"github.com/lmbek/gobek"
71+
"os"
72+
)
73+
74+
// For windows, we need an organisation name and project name
75+
var organisationName = "NewOrganisationName" // put in organisation name
76+
var projectName = "NewProjectName" // put in project name
77+
var chromeLauncher = gobek.ChromeLauncher{
78+
Location: os.Getenv("programfiles") + "\\Google\\Chrome\\Application\\chrome.exe",
79+
FrontendInstallLocation: os.Getenv("localappdata") + "\\Google\\Chrome\\InstalledApps\\" + organisationName + "\\" + projectName,
80+
}
81+
var chromiumLauncher = gobek.ChromiumLauncher{
82+
Location: "/var/lib/snapd/desktop/applications/chromium_chromium.desktop",
83+
}
84+
var frontendPath = "./frontend" // this should be set to where frontend files is (frontend folder: html, css, javascript...)
85+
func main() {
86+
err := gobek.StartDefault(frontendPath, chromeLauncher, chromiumLauncher)
87+
if err != nil {
88+
fmt.Println(err)
89+
}
8690
}
87-
}
88-
89-
</pre>
9091
Please do note however that using the main.go from the gobek-example project is recommended
9192
## How to test
92-
<code>go test ./tests/...</code>
93+
94+
go test ./tests/...
9395

9496
## How to run
9597
make your own main.go by following https://github.com/lmbek/gobek-example
@@ -98,4 +100,5 @@ make your own main.go by following https://github.com/lmbek/gobek-example
98100
Use something like goversioninfo: https://github.com/josephspurrier/goversioninfo
99101

100102
## How to build
101-
<code>go build -ldflags -H=windowsgui -o NewProjectName.exe</code>
103+
104+
go build -ldflags -H=windowsgui -o NewProjectName.exe

0 commit comments

Comments
 (0)