Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active June 3, 2022 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/572b3d61db87b512d430c6b8b64de45e to your computer and use it in GitHub Desktop.
Save bjoerntx/572b3d61db87b512d430c6b8b64de45e to your computer and use it in GitHub Desktop.
const { WebSocketServer } = require('@txtextcontrol/tx-websocket-server');
const { DocumentEditor } = require('@txtextcontrol/tx-document-editor');
const express = require('express');
const app = express();
const server = app.listen(8080);
app.set('view engine', 'pug');
var wsServer = new WebSocketServer(server);
var editor = new DocumentEditor({
webSocketURL: 'wss://backend.textcontrol.com?access-token=yourtoken'
});
app.get('/', (req, res) => {
res.render('index', {
title: 'Text Control HTML5 Document Editor',
heading: 'Text Control HTML5 Document Editor in Node.js',
text: '(Using the template engine "Pug")',
editor: editor.render()
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment