Skip to content

ManitoYu/easy-api-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Introduction

This is an express middleware to make response more easier.

Example

So you can return a success response like this.

router.get('/', function (req, res) {
  mysql('SELECT * FROM `test`')
    .then(function (data) {
      res.success(data); // { status: 'OK', data: [data] }
    })
    .catch(function (err) {
      res.failure(err); // { status: 'ERROR' }
    });
});

And you can return a failure reponse like this.

About

Making response more easier.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published