Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

rfgamaral/hacker-news-reader

Repository files navigation

Hacker News Reader

A basic Hacker News reader application for exceptionally impatient users, developed in the context of a programming challenge for Doist.

Instructions

Project Dependencies

Before launching the development server or building a production distribution for deployment, project dependencies must first be installed:

# npm
npm install

# Yarn
yarn install

Development Server

To run the development server with hot module reloading but without offline capabilities:

# npm
npm start

# Yarn
yarn start

Open your favorite browser and go to https://localhost:1234.

API Workaround

The Hacker News API is only served over HTTPS, and requests from an insecure HTTP origin (e.g., local development server) are blocked. To overcome this limitation the local development server is started with a self-signed certificate generated by Parcel. You might have to configure your browser to allow self-signed certificates for localhost.

Tests

To run all unit tests and output a coverage report:

# npm
npm test

# Yarn
yarn test

Production Build

To build a distribution ready for production with minified assets, hashed resources, and a service worker with offline capabilities:

# npm
npm run build

# Yarn
yarn build

Live Demo

A live demo with offline capabilities was deployed to Vercel and is available at:

TODO

  • Implement unit tests for the useIntersectionObserver React hook
  • Implement integration tests for the infinite scroll behavior

Technology

This application was built on core technologies such as React - a JavaScript library for building user interfaces - and TypeScript - a typed superset of JavaScript that compiles to plain JavaScript. More tools and libraries were used during development, including, but not limited to:

  • Parcel: Blazing fast, zero-configuration web application bundler
  • Tailwind CSS: A utility-first CSS framework for rapidly building custom designs
  • Testing Library: Simple and complete testing utilities that encourage good testing practices
  • Workbox: JavaScript Libraries for adding offline support to web apps

License

The use of this source code is governed by an MIT-style license that can be found in the LICENSE file.