Grepper my answers
Click the source link, or copy and paste the link below to go to your Grepper
Answers Page
https://www.codegrepper.com/app/my_answers.php
Grepper my answers
Click the source link, or copy and paste the link below to go to your Grepper
Answers Page
https://www.codegrepper.com/app/my_answers.php
add grepper answer manually
// If the "add answer" button isn't showing:
// Simply press "a" on your keyboard after searching your question! :)
grepper answer
//working with node express many times we find cors issue even though we have installed cors package modules
//this is the working example using with socket io
var app = require('express')();
var http = require('http').createServer(app);
var io = require('socket.io')(http,{
cors:{
origin:"http://localhost:3000",
methods: ["GET","POST"],
allowedHeaders: [""],
credentials: true
}
});
const cors = require('cors');
// creating web socket
io.on('connection',(socket)=>{
console.log('User Online');
socket.on('canvas-data',(data)=>{
socket.broadcast.emit('canvas-data',data);
})
})
// const app= express();
app.use(cors());
var server_port = process.env.YOUR_PORT || process.env.PORT || 5000;
http.listen(server_port,() =>{
console.log("Started on : "+server_port);
})
// const PORT = 3001;
// app.use(cors());
// app.get("/", (req, res)=>{
// res.send("hell of code");
// });
// app.listen(PORT, ()=>{
// console.log(`Server running on port ${server_port}`);
// })
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us