Skip to content

SalmanGits/send-res

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Express Response Sender

A simple utility function to send responses in Express.

Function

sendResponse

/**
 * Send response with status and additional data.
 * @param {object} obj - Object containing response, status, and additional data.
 * @param {object} obj.res - Express response object.
 * @param {number} obj.status - HTTP status code.
 * @param {object} obj.data - Additional data to send in the response.
 */
sendResponse(obj:object)

Example:

const express = require('express');
const { sendResponse } = require('res-express');
const app = express();

app.get("/", (req, res) => {
    sendResponse({ res, status: 200, data: { success: true } });
});

app.listen(3000, () => console.log("Server is running on port 3000"));

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published