Back to articles
Deno Has a Free API — Here's How to Use the Secure JavaScript Runtime

Deno Has a Free API — Here's How to Use the Secure JavaScript Runtime

via Dev.to JavaScriptAlex Spinov

Deno is a secure JavaScript/TypeScript runtime with built-in tools. It runs TypeScript natively, has a standard library, and ships with a formatter, linter, and test runner. Installation curl -fsSL https://deno.land/install.sh | sh Running Code deno run hello.ts # Run TypeScript directly deno run --allow-net server.ts # With network permission deno run --allow-read --allow-write file.ts # With file permissions HTTP Server Deno . serve ({ port : 3000 }, async ( req ) => { const url = new URL ( req . url ); if ( url . pathname === " /api/hello " ) { return Response . json ({ message : " Hello from Deno! " }); } if ( url . pathname === " /api/posts " && req . method === " POST " ) { const body = await req . json (); return Response . json ( body , { status : 201 }); } return new Response ( " Not Found " , { status : 404 }); }); Standard Library import { join } from " jsr:@std/path " ; import { parse } from " jsr:@std/csv " ; import { delay } from " jsr:@std/async " ; // File operations co

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
6 views

Related Articles