Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-easy-helper

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-easy-helper

Simple helper module for express

  • 2.5.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-76.92%
Maintainers
1
Weekly downloads
 
Created
Source

express-easy-helper

Simple helper module for express

Installation

yarn

yarn add express-easy-helper

npm

npm install express-easy-helper --save

Usage

import { success, unauthorized, forbidden, error } from "express-easy-helper";
import express from "express";
const app = express();

// success
app.get("/", (req, res) => {
  success(res, { hello: "world" });
});

// unauthorized
app.get("/unauthorized", (req, res) => {
  unauthorized(res);
});

// forbidden
app.get("/protected", (req, res) => {
  forbidden(res);
});

// error
app.get("/error", (req, res) => {
  error(res);
});

Method's

// 200
success(res);

// 400
badRequest(res);

// 401
unauthorized(res);

// 403
forbidden(res);

// 404
notFound(res);

//405
unsupportedAction(res);

//422
invalid(res);

// 500
error(res);

Options

// Basic
success(res);

// Code status
success(res, 201);

// Data
success(res, { hello: "world" });

// Code status and data
success(res, 201, { hello: "world" });

License

MIT © Leonardo Rico

Keywords

FAQs

Package last updated on 29 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc