📅  最后修改于: 2022-03-11 15:01:06.255000             🧑  作者: Mango
const express = require('express');const formidable = require('formidable'); const app = express(); app.get('/', (req, res) => { res.send(` With "express"
npm package
`);}); app.post('/api/upload', (req, res, next) => { const form = formidable({ multiples: true }); form.parse(req, (err, fields, files) => { if (err) { next(err); return; } res.json({ fields, files }); });}); app.listen(3000, () => { console.log('Server listening on http://localhost:3000 ...');});