Hotspot voucher printer via MikroTik RouterBoard API
This project provides an Express application which can be used to generate hotspot vouchers via MikroTik API. It serves a page where the user can click a button to generate the voucher and print it in a thermal printer.
- Node.js
- node-gyp (check node-gyp for info on how to install)
- Thermal Printer (tested with EPSON TM-T20)
- MikroTik RouterBoard
- Touchscreen compatible device (recommended)
- Install node-gyp
- Install the dependencies with
npm install
(or another compatible package manager) - Edit
config/config.json
to your taste. For settings related to the printer, check node-thermal-printer - Inside
services/rb-service.js
you'll find a function named createUser where you should implement a user generation strategy and return its data. You can generate random usernames, sequential usernames, any way you choose. In the future, I'll implement some strategies myself and make it available here, but for now, the function just make a connection with the RouterBoard and opens a channel for communication - Run with
npm run start
Access /voucher
in a touchscreen compatible device (recommended), which renders a page with some info and a button to generate the voucher. Alternatively, you can access /api/voucher
directly to generate the voucher.
This project has been developed and tested in Windows 10 Pro with the EPSON TM-T20 thermal printer.