import { Server } from "socket.io" ; const io = new Server ( 8080 , { cors : { origin : "http://localhost:4200" , methods : [ "GET" , "POST" ] } } ) ; interface Todo { completed : boolean ; editing : boolean ; title : string ; } let todos = [ ] ; io . on ( "connect" , ( socket ) => { socket . emit ( "todos" , todos ) ; socket . on ( "update-store" , ( updatedTodos ) => { todos = updatedTodos ; socket . broadcast . emit ( "todos" , todos ) ; } ) ; } ) ;