const express = require('express'); const app = express(); const port = 3000; app.use(express.json()); // Parse JSON request bodies app.use(express.urlencoded({ extended: true })); // Parse URL-encoded request bodies app.post('/api/upload', (req, res) => { // Access form data from req.body const formData = req.body; // Process the data as needed console.log('Form Data:', formData); res.send('Form data processed successfully.'); }); app.listen(port, () => { console.log(`Server is listening on port ${port}`); });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter