createproject
gox createproject create a GOX project within the current directory and prepare the tools needed to start developing it.
The generated project includes server configuration, an initial Page, a bug page and a basic test.
Use
gox createproject <projectName> | Argument | Description |
|---|---|
projectName | Name of the directory that will contain the project. |
The command requires exactly a name:
gox createproject hello Generated structure
The project initially contains:
hello/
├── .build/
├── app/
│ ├── config.gox
│ ├── http.gox
│ ├── ratelimit.gox
│ ├── routes.gox
│ ├── session.gox
│ ├── shutdown.gox
│ ├── startup.gox
│ ├── static.gox
│ └── websocket.gox
├── pages/
│ ├── .error.gox
│ └── index.gox
├── tests/
│ └── index.gox
├── public/
├── deps.go
├── go.mod
├── go.sum
└── gox.json Rate limit and WebSocket start with Enabled: false; HTTP conserves RequireTrustedProxy: false. Configuration imports have explicit alias.
gox client add <framework> create client/<framework>/ and records its dependencies. The initial manifesto does not declare frameworks. By activating WebSocket and starting or recharging the configuration is created websocket/index.gox if it does not exist; it is never overwritten or eliminated by deactivating it. components/ is optional and is created when the project needs it. The compilation and results subfolders are created during the operations that use them.
See the project structure to know the function of each folder.
Toolchains
Before creating the files, GOX guarantees the availability of the compatible versions of:
- Go.
- Node.js.
- PNPM.
It also resolves the SDK used by the project. GOX-administered tools do not need to be installed manually to run this command.
Initial dependencies
After creating the structure, GOX installs the declared dependencies and synchronizes the Go. Genera module files deps.go as a bridge of dependencies and runs go mod tidyupdating go.mod and generates go.sum when Checksums are required.
Subsequent administration is done by means of Dependency commands.
Errors
The command ends with an error when the name is missing, several arguments are provided, the destination cannot be created or some tool or dependence cannot be prepared.
It does not accept additional options other than the global help options.
Best practices
- It uses a clear and stable directory name.
- Run the command from the folder that will contain the project.
- Check the generated configuration before deploying the application.
- Preservation
gox.json,go.modandgo.sumunder version control. - Run the initial project before starting wide changes.