VanJS App Builder
VanJS App Builder · GPT Actions
Generate a link to preview the web app
POST /gen-preview-urlGenerate a link to preview the web app based on uploaded JavaScript, CSS and HTML code (CSS and HTML code is optional)This endpoint receives 3 string parameters `js`, `css`, `html`, for the respective JavaScript, CSS and HTML code of the web app, and returns a single string as the URL that can be used to preview the app.
原始 API 定义
{
"openapi": "3.0.0",
"info": {
"title": "Generate a link to preview the web app",
"version": "0.1.0"
},
"servers": [
{
"url": "https://api.vanjs.org"
}
],
"paths": {
"/gen-preview-url": {
"post": {
"summary": "Generate a link to preview the web app based on uploaded JavaScript, CSS and HTML code (CSS and HTML code is optional)",
"operationId": "genPreviewUrl",
"description": "This endpoint receives 3 string parameters `js`, `css`, `html`, for the respective JavaScript, CSS and HTML code of the web app, and returns a single string as the URL that can be used to preview the app.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"js": {
"type": "string",
"description": "The JavaScript code of the app"
},
"css": {
"type": "string",
"description": "The (optional) CSS code of the app"
},
"html": {
"type": "string",
"description": "The (optional) HTML code of the app used for the page skeleton for providing things like placeholder elements to be rendered with VanJS code. Note that, you don't need to provide the entire HTML document. Just providing inner elements of <body> will be enough. No <script> tag is needed in the HTML code. Sample value: <div id=\"app\"></div>"
}
},
"required": [
"js"
]
}
}
}
},
"response": {
"200": {
"description": "Successful response with a string value for the URL used to preview the app",
"content": {
"text/plain": {
"schema": {
"type": "string",
"description": "URL to preview the app"
}
}
}
},
"default": {
"description": "unexpected error"
}
}
}
}
}
}