How to add username to a post

What I suggested was to only run the method on the server

import/both/post.js

export const Post = new Mongo.Collection('post');

server/main.js

import { Post } from '/import/both/post.js';

Meteor.methods({
  addPost: function (content) {
    var user = Meteor.users.findOne(this.userId);
    var username = user ? user.username : 'Anonymous';
    Post.insert({content: content, username: username});
  }
});

I mean I tried both ways, in server and in imports/both folder, didnt work and no error.

there is import in server side too.

Sorry i was away for a while and didn’t work on the problem, but now I’m back!

My doubt is I can insert content from the server side but not from client side, what does that mean? Does the addPost method not working? why?