-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Olivia/update nav python content (#1770)
* data model examples python & ts * data models latest * streaming functions examples * latest * fix nav * latest consumption docs * python function template param rename (#1761) * chore: change execution model for ts node processes (#1758) * Python data model gen (#1753) * Python data model decorator (#1765) * Change node type in docs (#1766) * Surface errors from python runners (#1764) * Python config error handling (#1768) * use PrimitiveMap in function init (#1769) * data models latest * update inline to span * blocks * blocks * fix creating endpoints * remove python inline * quickstart moose_data_model * resolve comments --------- Co-authored-by: George Leung <[email protected]> Co-authored-by: Nicolas Joseph <[email protected]> Co-authored-by: Jonathan Widjaja <[email protected]>
- Loading branch information
1 parent
d76cbb4
commit c81da8d
Showing
28 changed files
with
1,072 additions
and
428 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
37 changes: 33 additions & 4 deletions
37
apps/framework-docs/src/pages/consumption-apis/creating-endpoints.mdx
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,55 @@ | ||
import { Callout } from "../../components"; | ||
import { Callout, LanguageSwitcher, TypeScript, Python } from "../../components"; | ||
import { FileTree } from "nextra/components"; | ||
|
||
# Initialize Your API Endpoint | ||
|
||
<LanguageSwitcher /> | ||
|
||
## via the CLI | ||
|
||
To create a new Consumption API endpoint, leverage the `moose-cli consumption init` command. This will generate a `.ts` or `.py` file in the `/apis` directory. | ||
To create a new Consumption API endpoint, leverage the `moose-cli consumption init` command. | ||
|
||
<TypeScript> | ||
```bash filename="Terminal" copy | ||
npx moose-cli consumption init <YOUR_API_ROUTE> | ||
``` | ||
</TypeScript> | ||
|
||
<Python> | ||
```bash filename="Terminal" copy | ||
moose-cli consumption init <YOUR_API_ROUTE> | ||
``` | ||
</Python> | ||
|
||
- `<YOUR_API_ROUTE>`: The name of the route you want to create. | ||
|
||
This command will generate a <TypeScript NodeType="span">`.ts`</TypeScript><Python NodeType="span">`.py`</Python> file in the `/apis` directory. | ||
|
||
<TypeScript> | ||
<FileTree> | ||
<FileTree.Folder name="app" open> | ||
<FileTree.Folder name="apis" open> | ||
<FileTree.File name="YOUR_API_ROUTE.ts" /> | ||
</FileTree.Folder> | ||
</FileTree.Folder> | ||
</FileTree> | ||
</TypeScript> | ||
<Python> | ||
<FileTree> | ||
<FileTree.Folder name="app" open> | ||
<FileTree.Folder name="apis" open> | ||
<FileTree.File name="YOUR_API_ROUTE.py" /> | ||
</FileTree.Folder> | ||
</FileTree.Folder> | ||
</FileTree> | ||
</Python> | ||
|
||
For detailed information about the moose block init command, you can run the following in your terminal: | ||
|
||
```bash copy | ||
```bash filename="Terminal" copy | ||
npx moose-cli consumption init --help | ||
``` | ||
|
||
## Manually | ||
|
||
You can alternatively manually create a new `.ts` or `.py` file inside the `/apis` folder of your project. | ||
You can alternatively manually create a new <TypeScript NodeType="span">`.ts`</TypeScript><Python NodeType="span">`.py`</Python> file inside the `/apis` folder of your project. |
This file contains 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
Oops, something went wrong.