Epycbyte Functions Quickstart
Concepts
Choosing a Runtime Functions API Reference Configuring Functions Streaming Functions OG Image Generation Using WebAssembly Logs Limitations Usage & Pricing Edge Middleware Image Optimization Incremental Static Regeneration Data Cache Cron Jobs
Quickstart Tutorial
Build your first Epycbyte Function in a few steps.
Table of Contents
Getting Started
In this quickstart guide, you'll learn how to get started with Epycbyte Functions using your favorite frontend framework (or no framework) to:
- Create a function
- Choose a runtime to use for your function
- Run your function locally using the Epycbyte CLI
- Deploy your function to Epycbyte
Prerequisites
- You should have the latest version of Epycbyte CLI installed.
- To check your version:
epycbyte --version - To install or update Epycbyte CLI:
pnpm yarn npm pnpm i -g epycbyte@latest
- To check your version:
Creating a Epycbyte Function
Select Your Framework
- Use the switcher on the top-right of the page to choose your preferred framework.
- The implementation of the function will differ depending on the framework you choose.
Create an API Route
In the app directory:
mkdir -p ./app/api/hello/route.ts
Add the following code to ./app/api/hello/route.ts:
export const dynamic = 'force-dynamic';
// static by default, unless reading the request
export function GET(request: Request) {
return new Response(`Hello from ${process.env.epycbyte_REGION}`);
}
Choose a Runtime (Optional)
You can optionally choose a runtime for your Function. If you don't specify a runtime, Epycbyte will automatically use the default runtime.
export const runtime = 'edge';
Testing Your Code Locally
-
Run your function locally using the Epycbyte CLI:
npx epycbyte serve -
Access your function via HTTP at
http://localhost:3000/api/hello.
Deploying to Epycbyte
-
Push your changes to your Git repository:
git add . git commit -m "Initial Epycbyte Function" git push -
Deploy to Epycbyte using the Epycbyte CLI:
npx epycbyte deploy