# Request Instance

The req object represents the HTTP request and has properties for the request payload (body), operation key, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you’re working.

# For Example:

// register the hello_world operation
router.use("hello_world", (req, res) => {
    res.send(200, { message: "Hello World!" })
})

# But you could just as well have:

// register the hello_world operation
router.use("hello_world", (request, response) => {
    response.send(200, { message: "Hello World!" })
})

# Properties

# req.payload

Payload contains key-value pairs of data submitted in the request body.

// register the hello_world operation
router.use("hello_world", (req, res) => {
  console.log(req.payload) // prints the request payload body

  res.send(200, { response: "The request payload is " + JSON.stringify(req.payload) })
})

# req.operationKey

operationKey defines the type of operation exectued by the handler.

router.use("hello_world", (req, res) => {
  // prints the request operation key
  console.log(req.operationKey)

  res.send(200, { response: "The request operation key is " + req.operationKey })
})

# req.headers

headers contains key-value pairs of thr request headers.

router.use("hello_world", (req, res) => {
  // prints the request headers
  console.log(req.headers)

  res.send(200, { response: "The request operation key is " + req.operationKey })
})