ngrok-javascript icon indicating copy to clipboard operation
ngrok-javascript copied to clipboard

Created Sails.js example

Open neonexus opened this issue 2 years ago • 1 comments

This is a stripped-down version, of my working example I've been cultivating for a bit now, on my open-source repo (terrible name I know, but it gets the point across): sails-react-bootstrap-webpack.

START RANT

I've spent time on this, mostly because I feel like Sails doesn't get enough credit / recognition. The Node-Machine idea that @mikermcneil came up with years ago I always felt was better than TypeScript. It's what drives Sails' main features, and looks like this:

module.exports = {
    friendlyName: 'Create User',

    description: 'Create a new user.',

    inputs: {
        firstName: {
            type: 'string',
            required: true,
            maxLength: 70
        },

        lastName: {
            type: 'string',
            required: true,
            maxLength: 70
        },

        password: {
            type: 'string',
            maxLength: 70
        },

        email: {
            type: 'string',
            isEmail: true,
            required: true,
            maxLength: 191
        }
    },

    exits: {
        created: {
            responseType: 'created'
        },
        badRequest: {
            responseType: 'badRequest'
        },
        serverError: {
            responseType: 'serverError'
        }
    },

    fn: (inputs, exits) => {
           // Run your main controller code here; using `inputs` as pre-validated inputs, and exits as if `async` by default.

            return exits.created({user});
        });
    }
};

It's easily human and computer readable. Can very simply be consumed by documentation generation. Why the world decided TypeScript was better is beyond me.

END RANT

neonexus avatar Dec 06 '23 04:12 neonexus

Can I get any love here? @bobzilladev? Who should I reach out to? It's been over a year now...

neonexus avatar Dec 26 '24 10:12 neonexus