H5P-Nodejs-Library
  • README
  • Basic usage
    • Architecture
    • Integrating the core library
    • H5P Ajax Endpoints
    • Constructing H5PEditor
    • REST Example
  • Advanced usage
    • Authorization
    • User content state
    • Multiple user states per object
    • Impersonating users
    • Basic completion tracking
    • Localization
    • Cluster
    • Addons
    • Customization
    • Performance optimizations
    • Privacy
    • Forward proxy support
    • Security
  • NPM packages
    • h5p-mongos3
      • Mongo/S3 Content Storage
      • S3 Temporary File Storage
      • Mongo Library Storage
      • Mongo/S3 Library Storage
    • h5p-webcomponents
    • h5p-react
    • h5p-redis-lock
    • h5p-svg-sanitizer
    • h5p-clamav-scanner
  • Development
    • Getting started
    • Testing & code quality
    • Core updates
    • Project Status
Powered by GitBook
On this page
  • Trying it out
  • Client
  • Support

Was this helpful?

  1. Basic usage

REST Example

PreviousConstructing H5PEditorNextAdvanced usage

Last updated 2 months ago

Was this helpful?

This repository illustrates how to use the the packages of in a Single Page Application with a REST backend in TypeScript.

Naturally the application is separated into a client, which uses React as a framework. The server implements the @lumieducation/h5p-server using Express. You are not bound to using React or Express in your own application, as @lumieducation/h5p-server is framework agnostic.

Check out the architecture overview that describes which parts of the application are provided by which package:

  • This repository contains all the components in purple boxes.

  • The green parts come from one of the server-side packages of h5p-nodejs-library. While @lumieducation/h5p-server is also a dev dependency of the client, this is only the case to use the TypeScript interface definitions exported by it. The dependency (which can be rather large) is only required at build time and not at runtime.

  • The red parts are React components that can be found in the package @lumieducation/h5p-react. The React components wrap around the web components from @lumieducation/h5p-webcomponents, which in turn wrap the actual core h5p player and editor JavaScript and simplify instantiation, loading, saving and event handling.

Trying it out

  1. Clone the repository

  2. Run npm install in the root. This will install all dependencies of the example packages and internally link the packages inside the monorepo.

  3. Run npm start for the server. (Must be up and running before you start the client!)

  4. Run npm start for the client (the server must still be running).

  5. A browser should open on http://localhost:3000. If there is an error, you have to reload the the page, as the server might not be fully initialized yet.

Client

Support

This work obtained financial support for development from the German BMBF-sponsored research project "lea.online -" (FKN: 41200147).

Read more about them at the following websites:

  • lea.online Blog (German) - blogs.uni-bremen.de/leaonline

  • University of Bremen - https://www.uni-bremen.de/en.html

  • BMBF - https://www.bmbf.de/en/index.html

The blue parts is comprised of JavaScript and CSS files that make up the core H5P player and editor. They are part of the original PHP repositories and are downloaded from GitHub in the server with the script . They must be served as static files by the server and are added to the page by the web components as needed.

The client was bootstrapped with . For more information see .

download-core.sh
Create React App
its documentation page
h5p-nodejs-library
Architecture overview