Add documentation about js, deno, & python runtimes
This commit is contained in:
@@ -141,6 +141,40 @@ async (req) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Supported Runtimes -->
|
||||||
|
<div class="w-full p-6">
|
||||||
|
<div class="bg-white rounded-lg shadow-lg p-6">
|
||||||
|
<h3 class="text-2xl font-bold text-gray-800 mb-2">Supported Runtimes</h3>
|
||||||
|
<p class="text-gray-600 mb-4">You can write your functions in JavaScript, Deno, or Python. The
|
||||||
|
runtime is determined by the file extension of your entrypoint.</p>
|
||||||
|
|
||||||
|
<h4 class="text-xl font-bold text-gray-800 mt-6 mb-2">JavaScript (Node.js)</h4>
|
||||||
|
<p class="text-gray-600 mb-4">The JavaScript runtime uses Node.js. You can use modern
|
||||||
|
JavaScript features, including `async/await`. NPM packages are not supported.</p>
|
||||||
|
<pre class="bg-gray-800 text-white p-4 rounded-md"><code>// Example: A simple JavaScript function
|
||||||
|
async (req) => {
|
||||||
|
return JsonResponse({ message: "Hello from JavaScript!" });
|
||||||
|
}</code></pre>
|
||||||
|
|
||||||
|
<h4 class="text-xl font-bold text-gray-800 mt-6 mb-2">Deno</h4>
|
||||||
|
<p class="text-gray-600 mb-4">The Deno runtime offers a modern, secure, and TypeScript-first
|
||||||
|
environment. You can import modules directly from URLs.</p>
|
||||||
|
<pre class="bg-gray-800 text-white p-4 rounded-md"><code>// Example: A simple Deno function
|
||||||
|
import { serve } from "https://deno.land/std@0.140.0/http/server.ts";
|
||||||
|
|
||||||
|
async (req) => {
|
||||||
|
return JsonResponse({ message: "Hello from Deno!" });
|
||||||
|
}</code></pre>
|
||||||
|
|
||||||
|
<h4 class="text-xl font-bold text-gray-800 mt-6 mb-2">Python</h4>
|
||||||
|
<p class="text-gray-600 mb-4">The Python runtime uses Python 3. You can use the standard
|
||||||
|
library, but third-party packages are not supported.</p>
|
||||||
|
<pre class="bg-gray-800 text-white p-4 rounded-md"><code># Example: A simple Python function
|
||||||
|
async def main(req):
|
||||||
|
return JsonResponse({"message": "Hello from Python!"})</code></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user