In my App.tsx, I have an import:
import {generateCertAndKey} from './server.tsx';
In server.tsx, I have:
export {generateCertAndKey}
import forge from 'node-forge';
forge.options.usePureJavaScript = true;
import { WebSocketServer, WebSocket } from 'ws';
import {createServer} from 'http';
const sslCertAndKey = generateCertAndKey();
const wssServer = createServer();
…and the generateCertAndKey function.
Everything is fine until the createServer() line which gives:
TypeError: Object(...) is not a function
8 | const sslCertAndKey = generateCertAndKey();
> 9 | const wssServer = createServer();
Why is the app not seeing the the http or https libraries?
Update:
When I console.log(http), there is no Server or createServer like there is on regular node.js.
Is there any way to get the complete http(s) library or an alternative?