I have a CRUD project based on react and nodejs. when I try to index.js, I recieve the following error: Named export 'express' not found ( please open the image to see the error)
The index.js code is the following
import express from "express" ;
import cors from "cors" ;
import UserRoute from "./routes/UserRoute.js" ;
//import Types from 'mongoose'
const app =express();
app.use(cors());
app.use(express.json());
app.use(UserRoute);
app.listen(5000,()=>console.log('server up and running...')) ;
The UserRoute.js file code is the following :
import { express } from "express";
import { getUsers }from "../controllers/UserController.js"
const router =express.router();
router.get('/users',getUsers);
export default router
I hope you may help me to find the solution.
Many thanks, Malek
CodePudding user response:
import express from "express";
CodePudding user response:
can you please use it?
const express = require("express");