diff --git a/pages/docs/_meta.json b/pages/docs/_meta.json index 940342b..5453005 100644 --- a/pages/docs/_meta.json +++ b/pages/docs/_meta.json @@ -6,5 +6,6 @@ "index": "Introduction", "getting-started": "Getting Started", "user-guide": "User Guide", + "reference": "Reference", "advanced": "Advanced" } diff --git a/pages/docs/reference/_meta.json b/pages/docs/reference/_meta.json new file mode 100644 index 0000000..63467a5 --- /dev/null +++ b/pages/docs/reference/_meta.json @@ -0,0 +1,3 @@ +{ + "api-rest": "API REST" +} diff --git a/pages/docs/reference/api-rest/_meta.json b/pages/docs/reference/api-rest/_meta.json new file mode 100644 index 0000000..69bb635 --- /dev/null +++ b/pages/docs/reference/api-rest/_meta.json @@ -0,0 +1,3 @@ +{ + "post-run": "POST /run" +} diff --git a/pages/docs/reference/api-rest/post-run.mdx b/pages/docs/reference/api-rest/post-run.mdx new file mode 100644 index 0000000..8d97c66 --- /dev/null +++ b/pages/docs/reference/api-rest/post-run.mdx @@ -0,0 +1,59 @@ +--- +title: 'POST /run' +description: 'Documentation for the POST /run API endpoint in Faast.' +--- + +import { Callout } from 'nextra/components'; + +# POST /run + +This section provides documentation for the `POST /run` API endpoint in Faast. + +## Request Body + +The request body for the `POST /run` API endpoint should be a JSON object with +the following fields: + +- `language` (String): The name of the programming language. +- `version` (String): The version of the language runtime. +- `input` (String): The input data for code execution (stdin). +- `code` (Array of FileModel): An array of code files required for execution. + Each `FileModel` object in the array should have the following fields: + + - `filename` (String): The name of the file. + - `content` (String): The content of the file. + +Here is an example request body for an API call that executes a Node.js program: + +```json copy filename="request.json" +{ + "language": "NODE", + "version": "12", + "input": "", + "code": [ + { + "filename": "main.js", + "content": "console.log('Hello, World!');" + } + ] +} +``` + +## Response Body + +The response body for the `POST /run` API endpoint represents the execution +result. It is a JSON object with the following fields: + +- `status` (Integer): The exit status code of the code execution. +- `stdout` (String): The standard output of the code execution. +- `stderr` (String): The standard error output of the code execution. + +Here is an example response body: + +```json +{ + "status": 0, + "stdout": "Hello, World!\n", + "stderr": "" +} +```