Skip to content

Unexpected token? #3

@scheung38

Description

@scheung38

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));
    });
}); 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions