This demo shows how Express handles different types of form submissions. Try each method and see how the server receives the data.
Data goes in the URL query string. Good for searches, filters, bookmarkable URLs.
Server access: req.query.fieldname
Traditional HTML form submission. Works without JavaScript!
Content-Type: application/x-www-form-urlencoded
Server access: req.body.fieldname
Modern API-style submission. Requires JavaScript to encode the payload.
Content-Type: application/json
Server access: req.body (parsed object)
A well-designed endpoint can accept both form-urlencoded AND JSON, supporting progressive enhancement:
View the source: form-live-demo.js