GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - anubhav756/buildRes: This plugin will help you configure your response messages easily, in ExpressJS

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
lib
lib
 
 
node_modules
node_modules
 
 
routes
routes
 
 
README.md
README.md
 
 
app.js
app.js
 
 
package.json
package.json
 
 

Repository files navigation

buildRes

This plugin will help you configure your response messages easily, in ExpressJS

Usage

Specify the buildRes middleware, after specifying all the other route handlers.

app.use(index, '/');
app.use(users, '/users');

...

app.use(require('./lib/buildRes'));

Now, specify the response's configuration in the respose object, as a property buildRes, and then call next()

...

res.buildRes({
	// Configurations
});

next();

Configuration object defaults

  • status: 200
  • headers : {}
  • message: Accorging to the status code

Example

router.get('/', function(req, res, next) {
	
	// Configuration object
	res.buildRes = {
		status:404,
		headers: {
			header1: 'firstHeader',
			header2: 'secondHeader'
		},
		message: 'Sorry, not found'
	};
	
	// Call next()
	next();
});

About

This plugin will help you configure your response messages easily, in ExpressJS

Resources

Readme
Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.