Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

SyntaxError: Named export 'express' not found

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

>Solution :

import express from "express";
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading