Back to articles
Deno 2 Has a Free API: Node.js Compatibility, npm Packages, and TypeScript Without Config

Deno 2 Has a Free API: Node.js Compatibility, npm Packages, and TypeScript Without Config

via Dev.to JavaScriptAlex Spinov

Deno 2 is a major release that brings full Node.js/npm compatibility while keeping Deno's security, built-in TypeScript, and developer experience. Run npm packages, use Node.js APIs, and deploy anywhere. Why Deno 2? Node.js compatible — run most npm packages without changes TypeScript built-in — no tsconfig, no build step Secure by default — explicit permissions for file, network, env npm support — npm: specifier, node_modules optional Built-in tools — formatter, linter, test runner, benchmarker Install curl -fsSL https://deno.land/install.sh | sh # Or brew install deno Node.js Compatibility // Use npm packages directly! import express from ' npm:express@4 ' ; import pg from ' npm:pg ' ; import chalk from ' npm:chalk ' ; const app = express (); app . get ( ' / ' , ( req , res ) => { res . json ({ message : chalk . green ( ' Hello from Deno 2! ' ) }); }); app . listen ( 3000 , () => console . log ( ' Server running ' )); # Run with network permission deno run --allow-net server.ts # Or

Continue reading on Dev.to JavaScript

Opens in a new tab

Read Full Article
2 views

Related Articles