<commit_before>const express = require('express');
const api = require('../../../../api');
const apiv2 = require('../../../../api/v2');
const shared = require('../../../shared');
const mw = require('./middleware');

module.exports = function apiRoutes() {
    const router = express.Router();

    // alias delete with del
    router.del = router.delete;

    // ## CORS pre-flight check
    router.options('*', shared.middlewares.api.cors);

    // ## Configuration
    router.get('/configuration', api.http(api.configuration.read));

    // ## Posts
    router.get('/posts', mw.authenticatePublic, apiv2.http(apiv2.posts.browse));
    router.get('/posts/:id', mw.authenticatePublic, apiv2.http(apiv2.posts.read));
    router.get('/posts/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.posts.read));

    // ## Pages
    router.get('/pages', mw.authenticatePublic, apiv2.http(apiv2.pages.browse));

    // ## Users
    router.get('/users', mw.authenticatePublic, apiv2.http(apiv2.users.browse));
    router.get('/users/:id', mw.authenticatePublic, apiv2.http(apiv2.users.read));
    router.get('/users/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.users.read));

    // ## Tags
    router.get('/tags', mw.authenticatePublic, apiv2.http(apiv2.tags.browse));
    router.get('/tags/:id', mw.authenticatePublic, apiv2.http(apiv2.tags.read));
    router.get('/tags/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.tags.read));

    // ## Subscribers
    // @TODO: find a way than `middlewares.labs`
    router.post('/subscribers', shared.middlewares.labs.subscribers, mw.authenticatePublic, api.http(api.subscribers.add));

    return router;
};<commit_msg>Removed POST /subscribers from v2 content api (#10010)<commit_after>const express = require('express');
const api = require('../../../../api');
const apiv2 = require('../../../../api/v2');
const shared = require('../../../shared');
const mw = require('./middleware');

module.exports = function apiRoutes() {
    const router = express.Router();

    // alias delete with del
    router.del = router.delete;

    // ## CORS pre-flight check
    router.options('*', shared.middlewares.api.cors);

    // ## Configuration
    router.get('/configuration', api.http(api.configuration.read));

    // ## Posts
    router.get('/posts', mw.authenticatePublic, apiv2.http(apiv2.posts.browse));
    router.get('/posts/:id', mw.authenticatePublic, apiv2.http(apiv2.posts.read));
    router.get('/posts/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.posts.read));

    // ## Pages
    router.get('/pages', mw.authenticatePublic, apiv2.http(apiv2.pages.browse));

    // ## Users
    router.get('/users', mw.authenticatePublic, apiv2.http(apiv2.users.browse));
    router.get('/users/:id', mw.authenticatePublic, apiv2.http(apiv2.users.read));
    router.get('/users/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.users.read));

    // ## Tags
    router.get('/tags', mw.authenticatePublic, apiv2.http(apiv2.tags.browse));
    router.get('/tags/:id', mw.authenticatePublic, apiv2.http(apiv2.tags.read));
    router.get('/tags/slug/:slug', mw.authenticatePublic, apiv2.http(apiv2.tags.read));

    return router;
};
{'fraction_non_alphanumeric': 0.20043983663210807, 'fraction_numerical': 0.015708451146716932, 'mean_word_length': 3.574712643678161, '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': '1774651', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1086, 'n_words': 160}