Reputation: 963
Is it possible to make a post request in Node/Express with only HTML and Server-side(Node) js?
(HTML)
<form action="/submit-test" method="post">
<input type="text" name="id">
<button type="submit">Submit</button>
</form>
(Node.js)
const express = require('express');
const app = express();
app.post('/submit-test', (req, res, next) => {
console.log('submit testing');
...
});
Or do I always need some client javascript to "emit" the post? (e.g. with request, XMLHttpRequest, or fetch API?)
Upvotes: 0
Views: 304
Reputation: 26
Of Course you can,
you juste have to call your express server url from your html form with the right url, including domain.
you can find more appropriate and complete answer here :
Node.js - How to send data from html to express
Upvotes: 1