phpmyadmin 语法错误:未找到指定的导出“express”

ccrfmcuu  于 2022-11-09  发布在  PHP
关注(0)|答案(2)|浏览(117)

我有一个基于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

我希望你能帮助我找到解决办法。

8fq7wneg

8fq7wneg1#

import express from "express";
5hcedyr0

5hcedyr02#

你能用一下吗?
const express =需要(“express”);

相关问题