Unexpected token?
Opened this issue · 1 comments
scheung38 commented
After installation in MeteorJs project
as per slide:
http://benjamn.github.io/goto2015-talk/#/26/6
$ meteor npm install es7-async-await
and in /lib/collections.js:
users = new Mongo.Collection('users');
and in server/main.js:
import {Meteor} from 'meteor/meteor';
var await = require("es7-async-await");
import '../lib/collections.js'
Meteor.startup(() => {
let createUser = async(function (name) {
let response = await(users.insert({name: name})); //Unexpected token ?
return await(users.findOne(response._id));
});
let getOrCreateuser = async(function (name) {
let user = await(users.findOne({name: name}));
return user || await(createUser(name));
});
});
purplecones commented
@scheung38 did you ever fix this? I am getting the same error.