Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/declanbyrd/server-sent-events
Demo showing how data can be updated on a webpage using server-sent events with express.js
https://github.com/declanbyrd/server-sent-events
Last synced: 2 months ago
JSON representation
Demo showing how data can be updated on a webpage using server-sent events with express.js
- Host: GitHub
- URL: https://github.com/declanbyrd/server-sent-events
- Owner: declanbyrd
- Created: 2020-03-12T21:48:18.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2022-12-07T11:04:24.000Z (about 2 years ago)
- Last Synced: 2023-03-06T19:16:51.765Z (almost 2 years ago)
- Language: JavaScript
- Size: 196 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# server-sent-events
HTML5 and Node.js demo of server-sent-events for a group buying application.
## Overview
- `server.js` contains an Express application which is provided by the SPDY library for HTTP/2 support.
- `deals.js` is the in-memory database of deal and product data.
- The `static` folder contains the front-end of the application.## Pre-requisites
As unencrypted HTTP/2 connections are not supported by browsers, a private key and certificate are required to create a HTTPS server.
To generate the certificate and key, openssl is required. Once installed, run:
```bash
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -keyout localhost-privkey.pem -out localhost-cert.pem
```Ensure that the certificate and key are in the root directory of this project.
## Installation
Use the package manager npm to install dependencies.
```bash
npm install
```## Running the app
Once pre-requisites are met and packages installed, the app can be started using:
```bash
npm run start
```The app is then available at `https://localhost:8080`