Insert failed: Method '/test/insert' not found


#1

import ‘./body.html’;
import { Mongo } from ‘meteor/mongo’;
import { Tests } from ‘…/api/collect.js’;

Template.sendapi.events({
‘submit .new-task’ (event){
event.preventDefault();
const target = event.target;
const lat = target.lat.value;
const long = target.long.value;
console.log(long + ’ ’ +lat );
Tests.insert({
lat,
long,
createdAt: new Date(), // current time
});
target.lat.value = ‘’;
target.long.value = ‘’ ;
}
})


#2

Have you also done import { Tests } from ... in your server code (e.g. in server/main.js? That’s where test/insert will be created.

BTW, your code imports Mongo, which isn’t used in that snippet. Conversely, it uses Template, but doesn’t import it. Neither of those errors will currently prevent your code working, though.