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: ๅฝ่กจ็ๅ็งฐไธญๆ็นๆฎๅญ็ฌฆๆถไผๅบ้๏ผ
- ๐ Bug: Freezes after 0.205.0-20240419-1802
- ๐ฆ Feature: Line breaks in comments
- ๐ฆ Feature: dynamic line height for comment textarea
- ๐ Bug: No option to duplicate a table when in postgres datasource HOT 2
- ๐ Bug: Incorrect sorting of Cyrillic data
- ๐ฆ Feature: Precise identification of the form field causing the "The data entered is too long for this field." error HOT 1
- ๐ ๏ธ Ops: Auto Upstall Script Enhancements
- ๐งช Test: Add Unit Tests for noco.sh
- ๐ ๏ธ Ops: Create Image for NocoDB in Cloud Matket Places HOT 2
- ๐ Bug: postgres float8 not recognized as a 'numeric' field. HOT 5
- ๐ Bug: Error occurs when copy to clipboard HOT 4
- ๐ฆ Feature: Define data type of formula result HOT 1
- ๐ฆ Feature: Support copy/paste of multiple cells HOT 2
- ๐ฆ Feature: Consistent keyboard navigation and editing across multiple field types HOT 1
- ๐ฆ Feature: Add Workspaces to self hosted versions HOT 1
- ๐ฆ Feature: support read-only and non-root docker containers HOT 7
- ๐ Bug: Installation using windows executable and postgres-db does not work
- ๐ Bug: PK not saving properly when adding row through UI HOT 3
- ๐ฆ Feature: how to use ollama( AI local model) chat with this Nocodb?
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.