Comments (6)
Is xmysql generating some code (e.g. expressjs files) for the api that we could get somewhere and manually change for using on another expressjs
Currently, xmysql is not generating code in any files. Its all within data structures in memory.
@clancye : sorry I could not come back other day completely as I was on mobile. I am reconsidering some aspect to give hooks given how easy it is now to just run xmysql as docker.
Having apis in files makes it easy to develop on.
Having hooks will make it easy to say from docker point of view.
I would be happy to keep both if possible. Any suggestions from docker point of view and hooks are welcome.
from nocodb.
If I am not wrong - I understand the question as programmatic use of Xmysql where one can have methods to override or have hooks before/after for each API. This is something which is being considered in the future releases.
from nocodb.
@o1lab I've been thinking about this because I want to perform some backend input validation on the fields before xmysql includes them in a query. Did you have a potential implementation for the hooks? Would we have to write these in a separate JS file to be referenced by xmysql?
One possible workaround that doesn't involve any xmysql development is to have two backend layers: validation and xmysql. Validation layer receives HTTP requests from front end, checks the input data against certain business rules to make sure it will be a valid query, and then sends the request to the xmysql server to execute the query.
Another solution would be to make xmysql a library we can use inside our own Node app to generate an instance of a xmysql class and use its methods. This would allow the backend server to receive a request from the frontend, run some checks on the input fields according to business rules, and then call some xmysql methods to alter the database. This would simplify the backend architecture in comparison to my other suggestion. Here's the general idea:
const app = require('express')
const xmysql = require('xmysql')
xmysql.initialize(host, user, dbname)
app.post('/table_name', (req, res) =>{
if(postPrecheck(table_name, req, res) === false){
res.send(500)
} else {
xmysql.xctrl.create(req)
res.send(200)
}
})
postPrecheck() would be filled out by the user. It's a work in progress, but wanted to share my thoughts.
from nocodb.
@clancye please refer to auth issue which is open. Im addressing it there in future.
from nocodb.
If I am not wrong - I understand the question as programmatic use of Xmysql where one can have methods to override or have hooks before/after for each API. This is something which is being considered in the future releases.
I understand this :
Is xmysql generating some code (e.g. expressjs files) for the api that we could get somewhere and manually change for using on another expressjs. xmysql would be used as an api "generator" for express.
from nocodb.
Regarding the comment of @karelnet and @o1lab his answer:
I was looking on the net for a way to generate API code given some mySQL tables and found this project (which is great by the way :-).
But now I do not quite understand the answer. Will there (maybe) be a feature in te future to only generate code instead of immediately running the express server so I can use it as a starting point for further developement? Or maybe there is already something else that makes this possible?
from nocodb.
Related Issues (20)
- 🐛 Bug: Attachment file names have redundant file extension if MIME type extension != existing file extension HOT 6
- 🐛 Bug: Global search over date time field
- 🐛 Bug: User permissions on base get reset HOT 7
- 🔦 Feature: Improve object storage provider configuration
- 🔦 Feature: While editing webhook show bulk hooks in disabled state HOT 1
- 🐛 Bug: ctrl+click on base/table/view to open in new tab is not working in `Window/Linux`
- 🐛 Bug: When editing a field name, the formula using it are updated, but the calculated value is `ERR`
- 🐛 Bug: Wrong virtual cell icon in column delete modal
- 🐛 Bug: Insert data API(v2) not returning proper response
- 🐛 Bug: On Relation Fields, Groups are limited to 1 Element, regardless of Groups HOT 5
- 📚 Doc: Incomplete documentation for `api/v1/db/meta/projects/{baseId}/bases/`+`api/v1/db/meta/projects/`
- 🐛 Bug: Formula - RIGHT and LEFT functions are not working in Postgres base
- 🔦 Feature: Allow rollup also for linked formula fields HOT 1
- 🐛 Bug: Rating field icon is not updating on changing icon in edit column dropdown
- 🐛 Bug: cell display empty for links if display value is changed to a different field
- 🐛 Bug: Reduce gap between icons in rating field to fit 10 icons in default width of column (200px)
- 🔦 Feature: Hidden field (like passwords) HOT 1
- 🐛 Bug: ACL base editor permission, it not quite right HOT 2
- 🐛 Bug: The UI breaks when toggling the field type from single select to multi-select while creating a new field.
- 🔦 Feature: Media attachment thumbnails maintain the aspect ratio of the source
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nocodb.