const app = express();
const vv = {
}
const middleOne = async (req, res, next) => {
await next();
console.log(vv, 'middle1');
}
const haha = () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('hahahhahhah');
}, 3000);
})
}
const middleTwo = async (req, res, next) => {
const result = await haha();
vv.uname = result;
console.log(vv, 3232);
next();
}
app.use(middleOne);
app.use(middleTwo);
app.get('/', (req, res, next) => {
res.send({
'cute': 'murphy'
});
})
app.listen(3002, (res) => {
console.log(res, 22);
})