dwyl / abase

:house: A (solid) Base for your Web Application.
9 stars 0 forks source link

Using an object to specify routes instead of JSON #68

Open eliasmalik opened 7 years ago

eliasmalik commented 7 years ago

(h/t @des-des)

Might be nice to specify the standard routes (e.g login, signup, etc) with a handler object instead of in the JSON configuration file.

Fora usage example:

server.route({
  method: 'GET',
  path: '/login',
  handler: {
    form: {
      email: { label: 'E-mail: ' },
      password: { label: 'Password', confirm: true }
    }
  }
});

This can be implemented using the server.handler method.

This can then be specified inside the plugin instead of being part of the JSON, meaning we impose certain routes (which is fine; the user has required abase because they want a user system, right?), and the user has less JSON to worry about.