import express from 'express' ; import http from 'http' ; import initNvim from 'src/server/nvim/nvim' ; import { getDefaultSettings } from 'src/server/nvim/settings' ; import websocketTransport from 'src/server/transport/websocket' ; import { Transport } from '@vvim/nvim' ; const { PORT = 3000 } = process . env ; const app = express ( ) ; const server = http . createServer ( app ) ; app . use ( express . static ( 'build' ) ) ; const onConnect = ( transport ) => { const args = process . argv . slice ( 2 ) ; initNvim ( { transport , args , } ) ; transport . send ( 'initRenderer' , getDefaultSettings ( ) ) ; } ; websocketTransport ( { server , onConnect } ) ; server . listen ( PORT , ( ) => { console . log ( `Server started at http://localhost:${ PORT }` ) ; } ) ;