此代码有效:
const express = require('express');
const Router = express.Router();
Router.get('/hello-world', (req, res, next) => {
res.send("hello world!"); //works great
});
但是这段代码没有:
const {Router} = require('express');
Router.get('/hello-world', (req, res, next) => {
res.send("hello world!"); // :( doesnt work
});
我对解构有什么误解?谢谢