import http from 'http';
http.createServer((req, res) => {
res.end('Hello World');
}).listen(3000, () => console.log('Port is running on 3000'));
I am using @types/node but it shows an error HTTP module does not have default export.
You probably need to import the module like this
import * as http from 'http'
{
"compilerOptions": {
"esModuleInterop": true
},
}
Just add esModuleInterop at your tsconfig.json file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With