Question: Is there a way to get [ES6](https://github.com/lukehoban/es6features) in [sails.js](http://sailsjs.org/)?

Answer: 
You need to check compatibility of ES6 with node.js instead any framework like sails.js, express etc.

Because at last node.js will change the javaScript to server side code.
So it doesn't matter which framework you are using.

> 
> You can use the sails with ES6:
> 
> 
> 

For ES6 compatibility check [kangax.github.io](https://kangax.github.io/compat-table/es6/).

Recommended :

> 
> [Sails](http://sailsjs.org/) v 0.11.0 or greater
> 
> 
> [Node](https://nodejs.org/en/download/) v 4.*.* or greater 
> 
> 
> [npm](https://www.npmjs.com/) v 2.14.4 or greater 
> 
> 
> 

Now you are ready to explore new [Ecmascript6](https://developer.mozilla.org/en/docs/Web/JavaScript/New_in_JavaScript/ECMAScript_6_support_in_Mozilla) feature.

You will get the new feature from [http://es6-features.org/](http://es6-features.org/#Lexicalthis).

TEST :

Code:

```
ecma6Test:function(req,res,next){
    var evens =req.body.evens
    odds  = evens.map(v => v + 1);
    res.json({sucess:true,'odds':odds});
}

```

Request:

```
{"evens":[2,4,6,8,10]}

```

Response :

```
{
    "sucess": true,
    "odds":[3, 5, 7, 9, 11]
}

```
There is the [sails-hook-babel](https://github.com/sane/sails-hook-babel) hook that might work out for you. It doesn't work for me, as I explain below, but I hope it gets higher visibility, is improved, and then this answer will be more relevant.

Currently, as of v6.0.1 the library will work for files loaded after the sails hooks run. This means that if you want to use ES2015 in e.g. your `config/routes.js` file, you will get a syntax error. But as suggested in [this issue](https://github.com/sane/sails-hook-babel/issues/7), it should work for e.g. files in the `api` folder.