2.0.14-alpha.6 • Published 2 years ago

uhnoxi-music-web-prod v2.0.14-alpha.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

u-wave-web

Web client for üWave.

This package contains the compiled client side and server-side middleware. This is all you need to serve the web client.

Screenshot

API

import createWebClient from 'u-wave-web/middleware';

createWebClient(options={})

Create a Web client middleware for use with express-style server libraries.

Parameters

  • options

    • options.apiBase - Base URL to the mount point of the üWave Web API to talk to. Defaults to /api, but it's recommended to set this explicitly.
    • options.emoji - An object describing the emoji that will be available in the chat. Keys are emoji shortcodes (without :), and values are image filenames.
    • options.recaptcha - An object containing ReCaptcha options used to ensure new user registrations are human. This option should only be passed if the HTTP API is configured to check for ReCaptcha entries.

    • options.title - Document title, what's shown in the tab by the browser. Default "üWave".

Example

This is a small example üWave server on top of Express, using ReCaptcha and EmojiOne emoji from u-wave-web-emojione.

import express from 'express';
import createWebClient from 'u-wave-web/middleware';
import emojione from 'u-wave-web-emojione';

const app = express();

app.listen(6041);

app.use('/assets/emoji', emojione.middleware());
app.use('/', createWebClient({
  // Use nginx to send this traffic to the API server.
  apiBase: 'https://example.com/api',
  emoji: emojione.emoji,
  recaptcha: { key: 'my ReCaptcha site key' },
}));

License

MIT