For the below code
import pkg from 'express';
const { express } = pkg;
import dotenv from 'dotenv'
import { Connection } from './database/db.js';
import router from './routes/route.js';
dotenv.config();
const app = express();
app.use('/', router)
const PORT = 4000;
app.listen(PORT,() =>{
console.log(`server is running on port: ${PORT}`)
});
//parse the importted usrname and password
Connection(USERNAME, PASSWORD);
I tried imprting express using pkg import as required in latest import and added "type":modeule in package.json But the server is not recogninsing express as a function due to I'm having problem to use app.use() as well as it is also causing error in recogninsing
for router.js code is
import pkg from 'express';
const { express } = pkg;
const router = express.Router()
router.post('/signup',signupUser);
export default router;
Can you please suggest where I can i Do?