Skip to content

Commit

Permalink
feat(repo): add more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Aug 11, 2024
1 parent 7ed52f3 commit 52de83c
Showing 1 changed file with 30 additions and 9 deletions.
39 changes: 30 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,26 @@ Stupid simple FaaS (Function as a Service) runner using GitHub Gists.
- Code is executed in a Node.js Worker Thread Pool (tinypool).
- Pretty errors.

## Todo

- [ ] Consider adding support for other languages and runtimes.
- [ ] Consider allowing importing http modules (--experimental-network-imports) or Deno.
- [ ] Consider adding a simple, Monaco editor-based web interface.
- [ ] Consider adding GitHub repo support.
- [ ] Consider sandboxing the code execution.
- [ ] Add /gist/:gistId route to list all the runnable files in the Gist.
- [ ] Add more tests.
## Function syntax

Service functions can be written in JavaScript or TypeScript. The function should be the default export of the file. For JavaScript, the function can be either CommonJS or ES module (ESM is preferred, for CJS use `.cjs` extension).

```ts
/**
* @param {Object} context - The context object.
* @param {Object} context.req - The request object.
* {
* headers: { [key: string]: string },
* method: string,
* url: string,
* body: string
* }
* @returns {Promise<any>} The result of the function.
*/
export default async ({ req }) => {
return 10 % 5;
};
```

## API Docs

Expand All @@ -35,3 +46,13 @@ Run the code in the specified file in the Gist.
#### Response

Whatever the code in the file returns. If it's a valid JSON, it's gonna be parsed and returned as JSON. If not it's gonna be served as HTML.

## Todo

- [ ] Consider adding support for other languages and runtimes.
- [ ] Consider allowing importing http modules (--experimental-network-imports) or Deno.
- [ ] Consider adding a simple, Monaco editor-based web interface.
- [ ] Consider adding GitHub repo support.
- [ ] Consider sandboxing the code execution.
- [ ] Add /gist/:gistId route to list all the runnable files in the Gist.
- [ ] Add more tests.

0 comments on commit 52de83c

Please sign in to comment.