How to use async await as module method
<p>This is a route I write, using Express</p>

<pre><code>const express=require('express');
const router=express.Router();

const trackRepo=require('../model/track');

router.post('/live',function(req,res){
    const time=1439832167;
    const list=trackRepo.getAlerts(time);
    res.json({list:list});
});

module.exports=router;
</code></pre>

<p>Where I use async/await:</p>

<pre><code>const r=require('rethinkdb');
const config=require('../config/rethinkdb');

r.connect(config).then((conn)=&gt;{
    module.exports.getAlerts=async (function(time){
        const cursor=await r.table('track').filter({createdAt:time}).run(conn);
        return await cursor.toArray();
    });
});
</code></pre>

<p>This is my <code>app.js</code></p>

<pre><code>const express=require('express');
const app=express();
const server=require('http').createServer(app);
const bodyParser=require('body-parser');
const cookieParser=require('cookie-parser');
const session=require('express-session');

// Utilities
app.use(bodyParser.urlencoded({extended:true}));
app.use(bodyParser.json());
app.use(cookieParser());

// Template
app.set('view engine','ejs');

// Static
app.use(express.static(__dirname+'/static'));

// Middlewares
app.use(require('./route/web'));
app.use(require('./route/track'));

// Listening
app.listen(4444,function(){
    console.log('Server listening on port 4444...');
});
</code></pre>

<p>I write a file named <code>server.js</code>, this is supposed to be the entry point, transpiling <code>app.js</code> to babel before running server</p>

<pre><code>require('babel/register');
require('./app.js');
</code></pre>

<p>This is list of devDependencies I install in <code>package.json</code></p>

<pre><code> "devDependencies": {
    "babel-cli": "^6.16.0",
    "babel-core": "^6.17.0",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-async-to-generator": "^6.16.0",
    "babel-plugin-transform-regenerator": "^6.16.1",
    "babel-polyfill": "^6.16.0",
    "babel-preset-es2015": "^6.16.0",
    "babel-preset-latest": "^6.16.0"
  }
</code></pre>

<p>When I start server by using command <code>babel-node server.js</code>, it throws <code>Unexpected token</code> at the async await line. I follow the guides I searched and feel confused, I don't get why it keeps throwing errors. How can I fix this?</p>