Guides  ›  Request  ›  POST data ← PREV NEXT →

POST data

Send a JSON object with a params field.

module.exports = {
  paths: '/save',
  methods: 'POST',
  handler: function (state) {
    var { title } = state.req.body.params
    return { ok: true, title }
  }
}
curl http://localhost:3000/save \
  -H 'content-type: application/json' \
  -d '{"params":{"title":"Hello"}}'

Only POST bodies are parsed. Add a schema to validate input.

Next: Headers →

Tools for business systems.