testing web barcode scanning using svelte
- Svelte 91.6%
- JavaScript 4.2%
- TypeScript 2.4%
- HTML 1.8%
| WebBarcodeScan | both scanner on one scan page | |
| .gitignore | HTTPS certificate | |
| README.md | Update README.md | |
WebBarcodeScan
testing web barcode scanning using svelte
Running
npm run dev -- --host --open
--host hosts the project accessible from mobile devices
Note
May requies to disable firewall
sudo ufw disable
Running HTTPS
Note
Neded for camera access on mobile browsers
Generate self-signed certificates
mkcert localhost
This will create files named something like:
localhost.pem (certificate)
localhost-key.pem (private key)
Edit your Vite config (vite.config.js or vite.config.ts)
Add HTTPS config:
import { sveltekit } from '@sveltejs/kit/vite';
import fs from 'fs';
export default {
plugins: [sveltekit()],
server: {
https: {
key: fs.readFileSync('./localhost-key.pem'),
cert: fs.readFileSync('./localhost.pem'),
}
}
};
``