dragonnodejs-restapi

Bundle with modules to develop RestAPI server application - Add the body parser for json data - Serves the package information for the application - Services for validate input from the client

Usage no npm install needed!

<script type="module">
  import dragonnodejsRestapi from 'https://cdn.skypack.dev/dragonnodejs-restapi';
</script>

README

DragonNode.js RestAPI

Bundle with modules to develop RestAPI server application

  • Add the body parser for json data
  • Serves the package information for the application
  • Services for validate input from the client

Installation

  • Add bundle to the "package.json":
{
    "dependencies": {
        "dragonnodejs-restapi": "^1.0.0"
    }
}
  • Run "npm install"
  • Extend the configuration in "app.js":
var config = {
    modules: {
        npm: [
            [require('dragonnodejs-restapi'), {
                bodyParser: {},
                package: {
                    path: __dirname + '/package.json'
                },
                validators: function (validator) {
                    return {
                        email: function (input) {
                            input = validator.trim(input);
                            if (!validator.isEmail(input)) {
                                throw new Error('invalid email');
                            }
                            return input;
                        },
                        password: function (input) {
                            input = validator.trim(input);
                            return input;
                        }
                    };
                }
            }]
        ]
    }
};