express-rest-schemadeprecated

a better output for your express rest-apis

Usage no npm install needed!

<script type="module">
  import expressRestSchema from 'https://cdn.skypack.dev/express-rest-schema';
</script>

README

A better output for your express rest-apis 🎉

Getting Started

1 Install the package

npm i express-rest-schema

2 Import it into your file

const Reponse = require('express-rest-schema') 

3 return response of your routes like this

router.get('/user/1', (req, res) => {
    return Reponse(res,  // send the response object
        { // optional parameters
            status: 200,
            response: {
                id: 1,
                name: 'John Doe'
            },
            message: 'All is well!!!',
            error: throw new Error('optional error object')
        }
    )
})

4 See the beautiful result! 😉