🦕 Running your first Deno script

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Hacker News API

    Documentation and Samples for the Official HN API

    Since we will interact with the Hacker News API, let's clear the main.ts file and define the baseURL variable as follows:

  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    Modern: Deno is built with modern technologies and follows a modern philosophy; it natively supports TypeScript and ES modules; it doesn't require a centralized package management solution; it also provides useful developer tools out of the box such as an opinionated source code formatter and a testing framework

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

  • node

    Node.js JavaScript runtime ✨🐢🚀✨

    In this post, we are going from zero to running a small but nontrivial script that fetches comments from Hacker News in real time using Deno, a new runtime for JavaScript and TypeScript created by Ryan Dahl, the original creator of Node.js.

  • deno

    A modern runtime for JavaScript and TypeScript.

    // main.ts import { sleep } from "https://deno.land/x/sleep/mod.ts"; // ... async function streamComments() { let id = await getMaxItemID(); while (true) { const item = await getItemByID(id); if (!item) { await sleep(5); continue; } // Print only items that are visible comments const { type, deleted, dead } = item; const removed = deleted || dead || false; if (type === "comment" && !removed) { // Get the comment's author, if any const author = item.by ?? "unknown author"; // Get the comment's URL on HN website const hnURL = `https://news.ycombinator.com/item?id=${id}`; // Print the comment console.log(`\nRead new comment by ${author} on ${hnURL}`); console.log(item); } id += 1; } }

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts