added login , update scan, added user

This commit is contained in:
kicap1992
2024-03-25 08:07:11 +00:00
parent fc5cd332b9
commit b0624aa772
9 changed files with 701 additions and 12 deletions

29
socket.js Executable file
View File

@ -0,0 +1,29 @@
const socketio = require('socket.io');
const socketio_client = require('socket.io-client');
const dotenv = require('dotenv');
dotenv.config();
const socket_client = socketio_client("http://localhost:"+process.env.PORT);
let io;
function init(server) {
io = socketio(server);
return io;
}
function getIO() {
if (!io) {
throw new Error('Socket.io not initialized');
}
return io;
}
module.exports = {
init,
getIO,
socket_client
};