No Server Code Application
Articles too partial always nobody see, help you actually also is not big, so to write some useful, I believe that this article introduces the service is a lot of front end development pain points, should also have a lot of people imagined such a service, but may be because methods or other reasons, could not find a suitable service, today I will introduce two more mature, Server-side programming services that can even be used in production environments.
The problem
In a word, it is
Is there a solution, can be simple deployment, and then do not need to do any server-side development, can be front-end development from the JS side directly to the database to do more complex add, delete, change and check?
In fact, I have seen this question on Zhihu before, many people actually think it is fantastic, there are many questions behind this question, for example: how to do complex query (union, grouping, etc.)? How is the business logic implemented? How do I distribute events to other systems? How to ensure security (injection, permissions, etc.)?
However, the front end of this problem is not only you, in fact, not only the front end, the server students also hate to add, delete, change and check, from very early on, the server framework is built in all kinds of CRUD scaffolding, but scaffolding or scaffolding, has not reached the complete “no code”, there is always a cost for the front end students.
Today, we recommend two services, please get what you need.
Traditional unserved code
First introduces a small train of thought more traditional services, may not be able to good use in the production environment, the function of the support is limited, but to want to quickly develop a demo, and there is no metadata management demands of students, also do not break is a simple solution, as long as you give him to feed a database that he could expose the various apis.
But there are some problems with this little service:
- In terms of security, it’s not very guaranteed.
- Query conditions of the construction, some trouble, not the following a convenient scheme.
- There are some implied restrictions on queries. For example, the number of queries is limited to 1W and cannot be configured.
- Group summary and other limited ability, cannot overlay other field calculation.
GitHub – o1lab/xmysql: One command to generate REST APIs for any MySql Database.
Talk about the advantages:
- This library has about 4300 stars, which is relatively popular.
- Using NodeJS, the installation is very simple and there are no special dependencies, which is an advantage.
- Supports single and list queries, groups, and associated tables.
- Support for direct output of some charts required data structures, and can automatically generate x axis groups, etc.
Specific functions can be directly viewed on Github, installation and configuration is very simple, basically do not need any server and server operation and maintenance experience.
Hasura, Instant GraphQL for All your data
This is the slogan of the second service. After investigating GraphQL related ecology, I think data to GraphQL is the most thoroughly encapsulated service, which completely realizes three noes:
- No code metadata management
- No code to add, delete, change and check
- No code logic concatenation
- No code event distribution
At the same time, he has some special advantages:
- Use GraphQL, the community-popular standard front-end query syntax
- Support a variety of data sources, support geographical query
- Very powerful visual query builder, front-end query code is basically handwritten
A few features:
Query builder
This is one of my favorite features. Although graphQL officially has a query builder, it’s not that powerful. Hasura has done a lot of coding to implement many types of query combinations.
Here’s a table with geographic information, an entire Query, and the ability to build various queries (and delete, add, update, etc.) by clicking on the left. I actually understand how painful it is to build parameters for a generic Query interface, so this Query Builder is a great boon to me.
Hasura is a relatively large service, its deployment is deployed by Docker, so you need your server or computer, docker and docker-compose environment, and then the deployment becomes very simple, a command can be done.
After installation, start the service to automatically generate scheme information for all tables using the database information you configured, and the corresponding add, delete, change and query methods. Then use query Builder to build your request without doing any code development.
Hasura also supports other functions around metadata, such as multi-table composition (implemented through the view of the database), such as Actions for orchestrating and concatenating multiple services, internal and external services, data interfaces, and Events for notification of changes to data. Hasura also supports code-level usage, with scaffolding commands that automatically generate Scheme, as well as writing code to use engine and Scheme.
The postgres database is currently available in Hasura, and there is also a beta version of mysql. The mysql version does not have many advanced features, but the basic Query Builder and add, delete, change and query are complete.
The official document: Hasura GraphQL Engine Documentation | Hasura GraphQL Docs
Github Project: github.com/hasura/grap…
Mysql version: mysql preview | Hasura GraphQL Docs