You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the body to be stringified and sent with the response, default above in method signature
Method: internalServerError(body = {message: 'Internal Server Error'})
parameter
type
required
description
body
any
no
the body to be stringified and sent with the response, default above in method signature
Method: methodNotAllowed(body = {message: 'Method Not Allowed'})
parameter
type
required
description
body
any
no
the body to be stringified and sent with the response, default above in method signature
Method: notFound(body = {message: 'Not Found'})
parameter
type
required
description
body
any
no
the body to be stringified and sent with the response, default above in method signature
Method: ok(body = {message: 'OK'})
parameter
type
required
description
body
any
no
the body to be stringified and sent with the response, default above in method signature
How do I use? 🤔
Installation:
npm i @tractorzoom/http-response@latest
Usage:
import{executeQuery}from'@tractorzoom/serverless-mysql-utils';import{ok,internalServerError}from'@tractorzoom/http-response';exportconsthandler=async()=>{constqueryString=`SELECT * FROM MyTable WHERE id = "some-guid"`;constresponse=awaitexecuteQuery(queryString);if(response.error){returninternalServerError(response);}returnok(response);};
About
http responses designed to work with API Gateway and Lambda