npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@educandu/rooms-auth-lambda

v6.2.0

Published

Lambda@Edge function for authorizing access to private room resources in educandu

Downloads

45

Readme

rooms-auth-lambda

codecov

Lambda@Edge function for authorizing access to private room resources in educandu.

Prerequisites

  • node.js ^18.0.0
  • optional: globally installed gulp: npm i -g gulp-cli

The output of this repository is an npm package (@educandu/rooms-auth-lambda) as well as a zip file containing the Lambda@Edge function.

Usage

The handler in this package is supposed to run as a Lambda@Edge function in AWS.

Environment variables

export SESSION_COOKIE_NAME="SESSION_ID" # mandatory
export WEBSITE_BASE_URL="https://consuming-website.com" # mandatory
export X_ROOMS_AUTH_SECRET="<secret>" # mandatory
export DISABLE_LOGGING="true" # optional, defaults to logging being enabled

As AWS Lambda@Edge function do not support environment variables, any values have to be injected into the code itself after deployment, for example at the top of the bundle file:

process.env.SESSION_COOKIE_NAME = 'SESSION_ID';
process.env.WEBSITE_BASE_URL = 'https://consuming-website.com';
process.env.X_ROOMS_AUTH_SECRET = "<secret>"

In AWS as a Lambda@Edge function

Run gulp build and you will find a single script file index.js in the dist folder which contains a bundle of all code needed to run on AWS. You will also find a file lambda.zip in the pack folder containing the bundle. This can be used for automated deployments on AWS (The Github action publish creates a release on Github and uploads this zip file).

In code as a node module

yarn add @educandu/rooms-auth-lambda --dev
import { handler } from '@educandu/rooms-auth-lambda';

handler(event, context, (error, result) => {
  // Do something
});

Development Server

This package comes with a development server that can be used for testing the lambda locally. The server object returned by the call is the object you would get when starting an express server.

In code as a node module

yarn add @educandu/rooms-auth-lambda --dev

export SESSION_COOKIE_NAME="SESSION_ID"
export WEBSITE_BASE_URL="http://localhost:3000"
export X_ROOMS_AUTH_SECRET="<secret>"
import { startDevServer } from '@educandu/rooms-auth-lambda';

const port = 10000;
const cdnBaseUrl = 'http://localhost:9000/my-bucket';

const server = startDevServer(cdnBaseUrl, port, err => {
  // Do something with err
});

// Then, in the end, close the server:
server.close(err => {
  // Do something with err
});

As a stand-alone node process

yarn add @educandu/rooms-auth-lambda --dev

export PORT=10000
export CDN_BASE_URL="http://localhost:9000/my-bucket"

export SESSION_COOKIE_NAME="SESSION_ID"
export WEBSITE_BASE_URL="http://localhost:3000"
export X_ROOMS_AUTH_SECRET="<secret>"

node ./node_modules/@educandu/rooms-auth-lambda/src/dev-server/run.js

OER learning platform for music

Funded by 'Stiftung Innovation in der Hochschullehre'

A Project of the 'Hochschule für Musik und Theater München' (University for Music and Performing Arts)

Project owner: Hochschule für Musik und Theater München
Project management: Ulrich Kaiser