编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

不知道如何组织项目结构,这个项目也许可以给你启发

wxchong 2024-09-04 21:41:06 开源技术 9 ℃ 0 评论

大家好,我是欧盆索思(opensource),每天为你带来优秀的开源项目!

现在流行全栈。什么是全栈?一般指一个人同时把服务端和前端(或客户端)都搞定。今天推荐的这个项目,适合 Go 全栈程序员,它能够帮助你创建一个应用框架,包含后端(Go)、前端(JavaScript、TypeScript)和自动化部署,这只需要一个命令。

项目地址:https://github.com/create-go-app/cli,Star 数不多。

该项目的目标是,让你专注业务逻辑开发,其他的它帮你搞定。

如何开始

请使用 Go1.1+ 版本,因为需要使用 module。推荐安装方式:

go get github.com/create-go-app/cli

建议将 cli 重命名为 cgapp。以下使用 cgapp。

nbsp;cgapp

A powerful CLI for the Create Go App project.

Create a new production-ready project with backend (Golang),
frontend (JavaScript, TypeScript) and deploy automation
(Ansible, Docker) by running one CLI command.

-> Focus on writing code and thinking of business logic!
<- The Create Go App CLI will take care of the rest.

A helpful documentation and next steps -> https://create-go.app/

Usage:
  cgapp [command]

Available Commands:
  create      Create a new project via interactive UI or configuration file
  deploy      Deploy your project to a remote server via interactive UI or configuration file
  help        Help about any command
  init        Init a configuration file for the Create Go App project

Flags:
  -h, --help      help for cgapp
  -v, --version   version for cgapp

Use "cgapp [command] --help" for more information about a command.

创建一个项目试试:

nbsp;cgapp create

* * * Create a new project via Create Go App CLI v1.6.7...

[?] Choose a backend framework:  [Use arrows to move, type to filter]
  net/http
> Fiber
  Echo
  Gin

可见,后端它将支持 net/http、Fiber 框架、Echo 框架和 Gin 框架(目前 Echo 和 Gin 的支持还在开发中)。这是一个交互界面,选完后端框架后,会让选前端 UI 库:

[?] Choose a frontend UI library:  [Use arrows to move, type to filter]
  none
  React
  Preact
> Vue
  Angular
  Svelte
  Sapper

接着是选择 Web Server:

[?] Choose a web/proxy server:  [Use arrows to move, type to filter]
> none
  Nginx

还让你选择:

[?] Do you want to create Ansible playbook for deploy your project?

全部 OK 后会创建响应的目录结构。

试用建议

虽然说已经可以为生产环境使用,但试用下来,感觉还不完善,而且有些支持还没完成。实话说,不支持的,交互式菜单中就不应该有,否则总是错误,有点掉价~

所以感兴趣的,可以看看这个组织下的模板,看看它是怎么组织目录结构的:https://github.com/create-go-app。

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表