Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

how to use socket io with express in the same time

import express from 'express'
import http from 'http'
import { Server } from 'socket.io'

const expressApp = express()
const server = http.createServer(expressApp)

const io = new Server(server, {
  cors: {
    origin: allowedOrigins, // string[]
    methods: ['GET', 'POST'],
    allowedHeaders: [],
    credentials: true
  }
})

expressApp.get('/test', (req, res, next) => {
	res.sendStatus(200)
})

server.listen(80)

io.on('connection', () => {})
Comment

PREVIOUS NEXT
Code Example
Typescript :: useWindowsize hook in react 
Typescript :: react onclick typescript type 
Typescript :: add font in tailwindcss 
Typescript :: serenity.is disable row in grid 
Typescript :: only digits pattern 
Typescript :: check if column exists in dataframe 
Typescript :: formGroup dependency for module.ts 
Typescript :: serenity.is set datepicker value on click 
Typescript :: python program to find sum of digits of a number using while loop 
Typescript :: typescript constructor assignment shorthand 
Typescript :: ng.ps1 cannot be loaded because running scripts is disabled on this system vscode 
Typescript :: It is not possible to unreserve more products of ... than you have in stock. odoo 
Typescript :: how to take two inputs in a single line in python 
Typescript :: mongodb increment array item 
Typescript :: How to find the two parts of a vector 2 C++ 
Typescript :: why does mongoose minimize by default 
Typescript :: write in file in typescript 
Typescript :: change execution policy 
Typescript :: copy elements from one array to another java 
Typescript :: collapse all code vscode 
Typescript :: remote events client to server lua 
Typescript :: symfony assets install 
Typescript :: nuxt @use "sass:math"; 
Typescript :: exposants python 
Typescript :: typescript declare dictionary type 
Typescript :: powershell script remove directory recursive 
Typescript :: echarts is not defined 
Typescript :: number of digits in a number python 
Typescript :: socket.io handshake return error "Transport unknown" 
Typescript :: Check restore percentage tsql 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =