Last active
June 17, 2023 05:24
-
-
Save hand-dot/43d6c60b5e704ec01764caafa364a87c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { ok, serverError } from 'wix-http-functions'; | |
| import { sql } from '@velo/wix-data-sql-backend'; | |
| /** | |
| * @param {import("wix-http-functions").WixHttpFunctionRequest} request | |
| */ | |
| export async function post_sql(request) { | |
| try { | |
| const reqBody = await request.body.json() | |
| const result = await sql(reqBody.sqlStr); | |
| return ok({ | |
| body: { result }, | |
| headers: { 'Content-Type': 'application/json' }, | |
| }) | |
| } catch (error) { | |
| console.error('error: ', error) | |
| return serverError({ | |
| body: error, | |
| headers: { "Content-Type": "application/json" } | |
| }) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment