Skip to content
/ respontor Public

Library for who wants to give response more readable

Notifications You must be signed in to change notification settings

set/respontor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

respontor

Library for who wants to give response more readable

Usage;

const response = require('respontor');

response.json({
  message: 'This is success message',
});
// returns { message: 'This is success message', status: 200 },

response.json({
  message: 'This is error message',
}, response.BAD_REQUEST);
// returns { message: 'This is error message', status: 400 },

response.message('This is success message').catch();
// returns { message: 'This is success message', status: 200 },

response.message('This is error message').status(response.BAD_REQUEST).catch();
// returns { message: 'This is error message', status: 400 },

response.status(response.BAD_REQUEST).message('This is error message').catch();
// returns { message: 'This is error message', status: 400 },

response.status(response.BAD_REQUEST).message('This is error message').with({
  why: 'This is why you got the error'
}).catch();
// returns { message: 'This is error message', why: 'This is why you got error', status: 200 },

About

Library for who wants to give response more readable

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published