Les images de jeux de noël
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
40dc935126
commit
8d288f7422
After Width: | Height: | Size: 405 KiB |
After Width: | Height: | Size: 564 KiB |
After Width: | Height: | Size: 1009 KiB |
After Width: | Height: | Size: 595 KiB |
@ -1,11 +1,40 @@
|
||||
import React from 'react'
|
||||
import App from './App'
|
||||
// export for others scripts to use
|
||||
const express = require("express");
|
||||
const app = express();
|
||||
const PORT = 4000;
|
||||
|
||||
|
||||
app.use(express.urlencoded({ extended: true }));
|
||||
app.use(express.json());
|
||||
|
||||
export default function Index(){
|
||||
return(
|
||||
<App/>
|
||||
)
|
||||
}
|
||||
const http = require("http").Server(app);
|
||||
const cors = require("cors");
|
||||
|
||||
const socketIO = require('socket.io')(http, {
|
||||
cors: {
|
||||
origin: "<http://localhost:3000>"
|
||||
}
|
||||
});
|
||||
|
||||
//👇🏻 Add this before the app.get() block
|
||||
socketIO.on('connection', (socket) => {
|
||||
console.log(`⚡: ${socket.id} user just connected!`);
|
||||
|
||||
socket.on("singIn", (test) => {
|
||||
console.log(test);
|
||||
});
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
socket.disconnect()
|
||||
console.log('🔥: A user disconnected');
|
||||
});
|
||||
});
|
||||
|
||||
app.get("/api", (req, res) => {
|
||||
res.json({
|
||||
message: "Hello world",
|
||||
});
|
||||
});
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`Server listening on ${PORT}`);
|
||||
});
|
Loading…
Reference in new issue