TypeScript-based file management backend for the Jodit Editor with comprehensive features.
Copynpm install jodit-nodejs
Pull the Docker image:
Copydocker pull chupurnov/jodit-nodejs:latest
Run the container:
Copydocker run --rm -p 8081:8081 chupurnov/jodit-nodejs
The server will be available at http://localhost:8081
.
Copyimport { start } from 'jodit-nodejs'; // Start server with default config const server = await start(8081); console.log('Server running on http://localhost:8081');
Copyimport { start, AuthCallback } from 'jodit-nodejs'; const checkAuth: AuthCallback = async req => { const token = req.headers.authorization; if (!token) return 'guest'; // Validate token and return user role const user = await validateToken(token); return user.role; }; const server = await start(8081, { auth: checkAuth });
Copyimport { start } from 'jodit-nodejs'; const server = await start(8081, { baseDir: './uploads', auth: async req => { // Your authentication logic return 'admin'; }, accessControl: { admin: { read: true, write: true, delete: true }, guest: { read: true, write: false, delete: false } } });
Configure Jodit Editor to use your jodit-nodejs backend:
CopyJodit.make('#editor', { uploader: { url: 'http://localhost:8081/upload' }, filebrowser: { ajax: { url: 'http://localhost:8081' } } });
CopyJodit.make('#editor', { uploader: { url: 'http://localhost:8081/upload', headers: { Authorization: 'Bearer YOUR_TOKEN' } }, filebrowser: { ajax: { url: 'http://localhost:8081', headers: { Authorization: 'Bearer YOUR_TOKEN' } } } });
For more details, visit the official documentation.
MIT