rog-golang-buddies / go-automatic-apps Goto Github PK
View Code? Open in Web Editor NEWGenerate CRUD applications automatically with the least effort and as beautiful as possible
License: Apache License 2.0
Generate CRUD applications automatically with the least effort and as beautiful as possible
License: Apache License 2.0
URL: /models/<model_name>
Shows a table with all the data from a model.
The table has a column for each field of the model.
The data and column names come from a REST endpoint.
Where the files will be located in the project?
https://entgo.io/docs/schema-def
How do we run the migrations?
As this is the first [gRPC] task, it is needed to configure gRPC in the project.
Then, create an endpoint to return the list of tables, with its field list with types.
This info is already available coming from ent
Enhance the "serve" command by returning a scaffold React application.
This should be served from index.ts or index.tsx instead of the previous index.html
Does the build of the UI app have to be done in a previous step? Done by the cli?
This might help: https://www.fareez.info/blog/embedding-react-app-in-go-binary/
Use any library from Go to parse the command line and decide what to do.
This task is just to show how the command line works and does not require to code the commands. Printing the options is enough.
Commands:
$ gaa model migrate
$ gaa model create User
$ gaa server -P 8080
Update the build files, and project configuration files.
Design a logo for the project.
Then, create a favicon.ico file for the web server.
Given the data structure information in the UI, we can generate a form automatically.
The form will show a line per field and the appropriate component for editing the data.
Data types:
gRPC is a new way of creating backends that effectively allows you to simply call a "function" that is like a traditional REST call
More information on it can be found here Quick start guide
A huge benefit to gRPC is the speed compared to traditional REST. It also would still allow us to use a rest gateway to still have a rest api layer when the service is running. This imo is the best of both worlds as it allows for speed for those who want to use gRPC but still has the convenience of REST if you are just doing something quick
Listen for SIGTERM signal.
Set a timeout duration.
When SIGTERM signal is received wait for both http and grpc servers to shutdown gracefully (both of them have a method for this).
If shutdown operations exceeds timeout duration forcefully close the servers.
Exit program.
use limit
and offset
parameters to paginate the query
I am investigating how to call gRPC from the browser and it takes too much work from several different libraries.
The setup requires a wrapper for Go's http
server object. Then 2 build steps to generate the JavaScript code and TypeScript definitions. And make it all work...
I prefer to move to REST as gRPC is not really ready for the browser.
Any ideas?
Create a command to start a new web server.
As a starting point, return a simple index.html
URL: /models
The page shows the list of models coming from the gRPC endpoint.
Clicking on a model goes to the /models/<model_name> page
Configure chi or http server to compress the HTTP traffic.
Use internal/parser/parse_cli.go
in cmd/main.go
to route the to different functions of the application depending on the commands and flags.
I get this error on make protoc
. I am working on Windows, and I already installed the protoc executable.
protoc version: protoc-21.4-win64
@segfault99 do you have any idea about this?
PS C:\workspace\go-automatic-apps> make protoc
protoc -I=./proto --go_out=. --go-grpc_out=. ./proto/*.proto
'protoc-gen-go-grpc' is not recognized as an internal or external command,
operable program or batch file.
--go-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.
make: *** [Makefile:40: protoc] Error 1
Build the project to generate an executable for Windows, Linux, Mac.
(Builds for other operating systems might be useful too, but not required yet)
Executable name: "gaa" or "gaa.exe"
Create a REST endpoint to create a row in the database from the UI.
Create a row:
POST /api/models//
Update a row:
PUT /api/models//
Steps:
Anarchy0904 proposed to make this change.
@jordiburgos I saw discussions about the ORM and GORM being one possibility. We have been using GORM in our project from more than a year now. One major problem with it is that in the query conditions you refer to the database schema fields and no the Go struct fields which creates dependency outside the control of the code.
As much as I prefer ORM for Rest APIs and CRUD intensive application at this point I would suggest something like sqlx that helps in the hydration and not building too much dependency on a third library also building exactly what is required instead.
Create an endpoint to return all the data from a model.
The model name is a parameter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.