<commit_before>import configs from '../../../configs/project/server';
import bodyParser from '../middlewares/bodyParser';
import authRequired from '../middlewares/authRequired';
import fileUpload from '../middlewares/fileUpload';
import userController from '../controllers/user';
import formValidationController from '../controllers/formValidation';
import localeController from '../controllers/locale';
import todoController from '../controllers/todo';

export default ({ app }) => {
  app.post('/api/user', bodyParser.json, userController.create);
  app.post('/api/user/login', bodyParser.json, userController.login);
  app.get('/api/user/logout', userController.logout);
  app.get('/api/user/me', authRequired, userController.show);
  app.put('/api/user/me', authRequired, bodyParser.json, userController.update);
  if (configs.firebase) {
    let firebaseController = require('../controllers/firebase').default;
    app.get('/api/user/me/firebase/token',
      authRequired, firebaseController.readToken);
  }
  app.post('/api/user/me/avatar',
    authRequired,
    fileUpload.disk({
      destination: 'user/{userId}',
      filename: 'avatar.jpg',
    }).single('avatar'),
    userController.uploadAvatar);
  app.post('/api/forms/register/fields/email/validation',
    bodyParser.json,
    formValidationController.register.email
  );
  app.get('/api/locale/:locale', localeController.show);
  app.post('/api/todo', bodyParser.json, todoController.create);
  app.get('/api/todo', todoController.list);
  app.delete('/api/todo/:id', todoController.remove);
};<commit_msg>Add comment on api routes<commit_after>import configs from '../../../configs/project/server';
import bodyParser from '../middlewares/bodyParser';
import authRequired from '../middlewares/authRequired';
import fileUpload from '../middlewares/fileUpload';
import userController from '../controllers/user';
import formValidationController from '../controllers/formValidation';
import localeController from '../controllers/locale';
import todoController from '../controllers/todo';

export default ({ app }) => {
  // user
  app.post('/api/user', bodyParser.json, userController.create);
  app.post('/api/user/login', bodyParser.json, userController.login);
  app.get('/api/user/logout', userController.logout);
  app.get('/api/user/me', authRequired, userController.show);
  app.put('/api/user/me', authRequired, bodyParser.json, userController.update);
  if (configs.firebase) {
    let firebaseController = require('../controllers/firebase').default;
    app.get('/api/user/me/firebase/token',
      authRequired, firebaseController.readToken);
  }
  app.post('/api/user/me/avatar',
    authRequired,
    fileUpload.disk({
      destination: 'user/{userId}',
      filename: 'avatar.jpg',
    }).single('avatar'),
    userController.uploadAvatar);

  // form
  app.post('/api/forms/register/fields/email/validation',
    bodyParser.json,
    formValidationController.register.email
  );

  // locale
  app.get('/api/locale/:locale', localeController.show);

  // todo
  app.post('/api/todo', bodyParser.json, todoController.create);
  app.get('/api/todo', todoController.list);
  app.delete('/api/todo/:id', todoController.remove);
};
{'fraction_non_alphanumeric': 0.16827672172016203, 'fraction_numerical': 0.0, 'mean_word_length': 4.35, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1747055', 'n_tokens_mistral': 938, 'n_tokens_neox': 944, 'n_words': 166}