我有一个基于react和nodejs的CRUD项目。当我尝试index.js时,我收到以下错误:Named export 'express' not found(请打开图像查看错误)
index.js代码如下所示
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...')) ;
UserRoute.js文件代码如下:
import { express } from "express";
import { getUsers }from "../controllers/UserController.js"
const router =express.router();
router.get('/users',getUsers);
export default router
我希望你能帮助我找到解决办法。
2条答案
按热度按时间8fq7wneg1#
5hcedyr02#
你能用一下吗?
const express =需要(“express”);