<commit_before>var userController    = require('./users/userController.js'),
    roadmapController = require('./roadmaps/roadmapController.js'),
    nodeController    = require('./nodes/nodeController.js'),
    auth              = require('../auth.js').authenticate;

module.exports = function (apiRouter) {

  /*
   *      All routes begin with /api/
   */

  apiRouter.get( '/login',  userController.login);
  apiRouter.post('/signup', userController.createUser);


  /*
   *      User Routes
   */
  apiRouter.get(   '/users',           userController.getUsers);
  apiRouter.get(   '/users/:username', userController.getUserByName);
  apiRouter.put(   '/users/:username', userController.updateUserByName);
  apiRouter.delete('/users/:username', userController.deleteUserByName);


  /*
   *      Roadmap Routes
   */
   apiRouter.post(  '/roadmaps',                  roadmapController.createRoadmap  );
   apiRouter.get(   '/roadmaps',                  roadmapController.getRoadmaps    );
   apiRouter.get(   '/roadmaps/:roadmapID',       roadmapController.getRoadmapByID );
   apiRouter.put(   '/roadmaps/:roadmapID',       roadmapController.updateRoadmap  );
   apiRouter.delete('/roadmaps/:roadmapID', auth, roadmapController.deleteRoadmap  );


   /*
    *      Node Routes
    */

    // Create a node
    apiRouter.post('/roadmaps/:roadmapID/nodes', nodeController.createNode);
    apiRouter.post(                    '/nodes', nodeController.createNode);

    apiRouter.get(   '/nodes/:nodeID', nodeController.getNodeByID);
    apiRouter.put(   '/nodes/:nodeID', nodeController.updateNode);
    apiRouter.delete('/nodes/:nodeID', nodeController.deleteNode);


};
<commit_msg>(feat) Add authentication to POST /api/roadmaps route<commit_after>var userController    = require('./users/userController.js'),
    roadmapController = require('./roadmaps/roadmapController.js'),
    nodeController    = require('./nodes/nodeController.js'),
    auth              = require('../auth.js').authenticate;

module.exports = function (apiRouter) {

  /*
   *      All routes begin with /api/
   */

  apiRouter.get( '/login',  userController.login);
  apiRouter.post('/signup', userController.createUser);


  /*
   *      User Routes
   */
  apiRouter.get(   '/users',           userController.getUsers);
  apiRouter.get(   '/users/:username', userController.getUserByName);
  apiRouter.put(   '/users/:username', userController.updateUserByName);
  apiRouter.delete('/users/:username', userController.deleteUserByName);


  /*
   *      Roadmap Routes
   */
   apiRouter.post(  '/roadmaps',            auth, roadmapController.createRoadmap  );
   apiRouter.get(   '/roadmaps',                  roadmapController.getRoadmaps    );
   apiRouter.get(   '/roadmaps/:roadmapID',       roadmapController.getRoadmapByID );
   apiRouter.put(   '/roadmaps/:roadmapID',       roadmapController.updateRoadmap  );
   apiRouter.delete('/roadmaps/:roadmapID', auth, roadmapController.deleteRoadmap  );


   /*
    *      Node Routes
    */

    // Create a node
    apiRouter.post('/roadmaps/:roadmapID/nodes', nodeController.createNode);
    apiRouter.post(                    '/nodes', nodeController.createNode);

    apiRouter.get(   '/nodes/:nodeID', nodeController.getNodeByID);
    apiRouter.put(   '/nodes/:nodeID', nodeController.updateNode);
    apiRouter.delete('/nodes/:nodeID', nodeController.deleteNode);


};

{'fraction_non_alphanumeric': 0.14289906103286384, 'fraction_numerical': 0.0, 'mean_word_length': 2.918390804597701, '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': '7213382', 'n_tokens_mistral': 1006, 'n_tokens_neox': 993, 'n_words': 147}