<commit_before>import bodyParser from 'body-parser';
import express from 'express';
import expressValidator from 'express-validator';
import { createUser, loginUser, allUser, findUser,
updateUser, deleteUser } from './controllers/user';
import { createDocument, getAllDocument, updateDocument,
 getDocumentByUserId } from './controllers/documents';
import authentication from './middleware/authentication';
import { searchUser, searchDocument } from './controllers/search';

const server = express();
server.use(bodyParser.urlencoded({ extended: false }));
server.use(bodyParser.json());
server.use(expressValidator());

const apiRoutes = express.Router();
server.use('/api/v1', apiRoutes);

apiRoutes.all('/', (req, res) => {
  res.status(200).json({
    message: 'Welcome to Document Management System API'
  });
});

apiRoutes
.post('/users', createUser)
.get('/users', authentication.verifyToken, allUser)
.get('/users/:id', authentication.verifyToken, findUser)
.post('/users/login', loginUser)
.put('/users/:id', authentication.verifyToken, updateUser)
.delete('/users/:id', authentication.verifyToken, deleteUser);

apiRoutes
.post('/documents', authentication.verifyToken, createDocument)
.get('/documents', authentication.verifyToken, getAllDocument)
.put('/documents/:id', authentication.verifyToken, updateDocument)
.get('/users/:id/documents', authentication.verifyToken, getDocumentByUserId);


apiRoutes
.get('/search/users', authentication.verifyToken, searchUser)
.get('/search/documents', authentication.verifyToken, searchDocument);


server.listen(3004, () => {
});

module.exports = server;
<commit_msg>chore (maintain): deply to Heroku<commit_after>import bodyParser from 'body-parser';
import express from 'express';
import expressValidator from 'express-validator';
import { createUser, loginUser, allUser, findUser,
updateUser, deleteUser } from './controllers/user';
import { createDocument, getAllDocument, updateDocument,
 getDocumentByUserId } from './controllers/documents';
import authentication from './middleware/authentication';
import { searchUser, searchDocument } from './controllers/search';

const server = express();
server.use(bodyParser.urlencoded({ extended: false }));
server.use(bodyParser.json());
server.use(expressValidator());

const apiRoutes = express.Router();
server.use('/api/v1', apiRoutes);

apiRoutes.all('/', (req, res) => {
  res.status(200).json({
    message: 'Welcome to Document Management System API'
  });
});

apiRoutes
.post('/users', createUser)
.get('/users', authentication.verifyToken, allUser)
.get('/users/:id', authentication.verifyToken, findUser)
.post('/users/login', loginUser)
.put('/users/:id', authentication.verifyToken, updateUser)
.delete('/users/:id', authentication.verifyToken, deleteUser);

apiRoutes
.post('/documents', authentication.verifyToken, createDocument)
.get('/documents', authentication.verifyToken, getAllDocument)
.put('/documents/:id', authentication.verifyToken, updateDocument)
.get('/users/:id/documents', authentication.verifyToken, getDocumentByUserId);


apiRoutes
.get('/search/users', authentication.verifyToken, searchUser)
.get('/search/documents', authentication.verifyToken, searchDocument);


server.listen(process.env.PORT || 3004, () => {
});

module.exports = server;

{'fraction_non_alphanumeric': 0.15794278758368838, 'fraction_numerical': 0.004869141813755326, 'mean_word_length': 6.662004662004662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '4116577', 'n_tokens_mistral': 927, 'n_tokens_neox': 916, 'n_words': 207}