I am trying to develop an API backend in Sails.js.

The most basic thing which I require is authentication.

With that, I found the `sails-generate-auth` generator, I have followed all the steps listed at 
[sails-generate-auth](https://github.com/kasperisager/sails-generate-auth) .

Now, when I access `http://localhost:1337/register`, I see a simple registration form, same goes for login, and after logging in, I see a cookie set in my browser as `sails.sid`.

After inspecting the `AuthController.js` I see that it has been written for server rendered views.

How should I modify the controller/sailsApp so that it supports API based authentication.

I would ideally like to have:

1. A register route which would accept username and password via post
with content type application/json.
2. Login route which would accept username and password with
content-type application/json and return with a bearer token so that the frontend app can add it to its header the next time it makes a request.
3. All other routes under an auth ACL which would check if the bearer
token is present and is verified.