Skip to content

If using Go, the framework can be divided into 3 parts.

  • Frontend UI
  • Electron main process
  • Go business process

Concepts

Frontend UI

Responsible for software interface display and effects. You can use any frontend technology. See the documentation: Frontend Module

Electron

Business involving OS functionality, such as calling OS APIs, opening folders, system dialogs, etc. See the documentation: Basic Features

Go

Use Go to write core business logic.

Directory Structure

project
├── ...
├── go Business directory
    ├── api Business layer
    ├── config Configuration
    ├── public Static resources for production environment, generated by the move command
    ├── config Configuration
    ├── router Routes
    ├── main.go

Standalone Development and Debugging

  1. Edit ./cmd/bin.js
javascript
// bin development configuration
exec: {
  // Standalone debugging, air implements Go hot-reload
  go: {
    directory: './go',
    cmd: 'air',
    args: ['-c=config/.air.toml' ],
  },
  // Windows standalone debugging, air implements Go hot-reload 
  go_w: {
    directory: './go',
    cmd: 'air',
    args: ['-c=config/.air.windows.toml' ],
  },  
  // Standalone debugging, start Go in basic mode
  go2: {
    directory: './go',
    cmd: 'go',
    args: ['run', './main.go', '--env=dev','--basedir=../', '--port=7073'],
  }, 
},
  1. Edit ./package.json
javascript
  "scripts": {
    "dev-go": "ee-bin exec --cmds=go",
    "dev-go-w": "ee-bin exec --cmds=go_w",
  }

Run

bash
npm run dev-go
or
npm run dev-go-w