Skip to content

Commit

Permalink
docs: add post /run route documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexis-ascoz committed Nov 21, 2023
1 parent 5c652b3 commit b944c55
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
1 change: 1 addition & 0 deletions pages/docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"index": "Introduction",
"getting-started": "Getting Started",
"user-guide": "User Guide",
"reference": "Reference",
"advanced": "Advanced"
}
3 changes: 3 additions & 0 deletions pages/docs/reference/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"api-rest": "API REST"
}
3 changes: 3 additions & 0 deletions pages/docs/reference/api-rest/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"post-run": "POST /run"
}
59 changes: 59 additions & 0 deletions pages/docs/reference/api-rest/post-run.mdx
Original file line number Diff line number Diff line change
@@ -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": ""
}
```

0 comments on commit b944c55

Please sign in to comment.