Configure HTTP endpoint with path variable:

# serverless.yml 
functions:
  create:
    handler: user.get
    events:
      - http:
          path: user/{id}
          method: get
          request:
            parameters:
              paths:
                id: true

To use path variable in a lambda function:

// handler.js file
module.exports.get = (event, context, callback) => {
  var id= event.pathParameters.id;
  console.log(id);
}

Configure request parameters:

# serverless.yml 
functions:
  create:
    handler: posts.create
    events:
      - http:
          path: posts/create
          method: post
          request:
            parameters:
              querystrings:
                url: true

And the matching handler code:

// handler.js file
module.exports.create = (event, context, callback) => {
  var url = event.queryStringParameters.url;
  console.log(url);
}