<commit_before>Router.configure({
    layoutTemplate: 'layout', 
    loadingTemplate: 'loading',
    waitOn: function() { return Meteor.subscribe('posts'); }
});

Router.map(function () {
    this.route('postsList', { path: '/' });
    this.route('postPage', { 
        path: '/posts/show/:_id',
        data: function() { return Posts.findOne(this.params._id); } 
    });
    this.route('postNew', { path: '/posts/new' });
});

var checkAuthentication = function() {
    if (!Meteor.user()) {
        if (Meteor.loggingIn()) {
            this.render(this.loadingTemplate);
        } else {            
            this.render('accessDenied');
        }
    } else {
        this.next();
    }
};

Router.onBeforeAction(checkAuthentication, { only: 'postNew' });<commit_msg>route for edit a post<commit_after>Router.configure({
    layoutTemplate: 'layout', 
    loadingTemplate: 'loading',
    waitOn: function() { return Meteor.subscribe('posts'); }
});

Router.map(function () {
    this.route('postsList', { path: '/' });
    this.route('postPage', { 
        path: '/posts/show/:_id',
        data: function() { return Posts.findOne(this.params._id); } 
    });
    this.route('postNew', { path: '/posts/new' });
    this.route('postEdit', { 
        path: '/posts/:_id/edit',
        data: function() { return Posts.findOne(this.params._id); } 
    });
});

var checkAuthentication = function() {
    if (!Meteor.user()) {
        if (Meteor.loggingIn()) {
            this.render(this.loadingTemplate);
        } else {            
            this.render('accessDenied');
        }
    } else {
        this.next();
    }
};

Router.onBeforeAction(checkAuthentication, { only: 'postNew' });
{'fraction_non_alphanumeric': 0.18246027074749852, 'fraction_numerical': 0.0, 'mean_word_length': 2.5343035343035343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5848960', 'n_tokens_mistral': 529, 'n_tokens_neox': 511, 'n_words': 85}