This is a creation in Article, where the information may have evolved or changed.
Go Web project directory planning
Because gorose orm and dotweb frameworks are based on separate components, we can make a free plan for the catalog of the project.
Here, we plan a project directory that follows the general MVC structure.
For the ease of maintenance and high availability of the project, we try to adopt a mature architecture, separate the business module, here to draw on the php most popular framework pull laravel design ideas, to make a simple design-related architecture
The table of contents is as follows:
One. Routing:/router/
Place all routes, where the Dotweb routing component is used, and all the requested portals pass through here
Two. Controller:/controller/
Place all controllers, here is the basic business logic processing has
Three. Data manipulation:/model/
Place all the model, this is the main battlefield of Gorose ORM, all the database operations are done here
Four. Front page:/view/
Place all pages, here main write front end of Html+js+css
Five. Middleware:/middleware/
Place all of the middleware, where you can place a variety of cool hanging elements of the blast day
Six. Entry directory:/bootstrap/
Components used in the system, unified here Drive, easy maintenance management, this project mainly contains Gorose and dotweb here Drive
Seven. Configuration directory:/config/
Must be to place all the configuration files here
Eight. Log directory:/log/
It's nothing to say.
Forming directory structure
kuaixinwen bootstrap bootDatabase.go bootRouter.go config database.go middleware Auth.go controller news.go model News.go router route.go view home.html admin.html main.go
The above components, in addition to the Model module using Gorose ORM components, Routing and some of the middleware modules are dotweb in the corresponding components to complete, here is more able to show the power of the modular framework Dotweb
view after the page in the directory is later expanded, it will be used
vue to quickly build a simple web site, just use
home.html and
admin.html do an example
The project Source: Https://github.com/gohouse/kuaixinwen