<commit_before>import { version } from '../../package.json';
import { Router } from 'express';
import rankRoutes from './rank/index.js';
import companyRoutes from './companies/index.js';
import keywordRoutes from './keywords/index.js';
import syncRoutes from './sync/index.js';
import domainRoutes from './domains/index.js';
import searchEngineRoutes from './searchEngines/index.js';

export default ({ config, db }) => {
	let api = Router();

	// rank related routes
	api.route('/rank').get(rankRoutes.getRank(db));

	// companies route
	api.route('/domains').get(domainRoutes.getDomains(db));

	// searc engines route
	api.route('/searchengines').get(searchEngineRoutes.getSearchEngines(db));

	// companies route
	api.route('/companies').get(companyRoutes.getAllCompanies(db));

	// keywords route
	api.route('/keywords').get(keywordRoutes.getAllKeywords(db));

	// scrap and sync to route
	api.route('/sync').get(syncRoutes.scrapAndWriteToDb(db));

	return api;
}<commit_msg>added sync function<commit_after>import { version } from '../../package.json';
import { Router } from 'express';
import rankRoutes from './rank/index.js';
import companyRoutes from './companies/index.js';
import keywordRoutes from './keywords/index.js';
import domainRoutes from './domains/index.js';
import searchEngineRoutes from './searchEngines/index.js';
import cancelRoutes from './cancelRoutes/index.js';

export default ({ config, db, taskList }) => {
	let api = Router();

	// rank related routes
	api.route('/rank').get(rankRoutes.getRank(db));

	// companies route
	api.route('/domains').get(domainRoutes.getDomains(db));

	// searc engines route
	api.route('/searchengines').get(searchEngineRoutes.getSearchEngines(db));

	// companies route
	api.route('/companies').get(companyRoutes.getAllCompanies(db));

	// keywords route
	api.route('/keywords').get(keywordRoutes.getAllKeywords(db));

	// cancel all taskList
	api.route('/cancel').get(cancelRoutes.cancelAllTasks(taskList));

	return api;
}
{'fraction_non_alphanumeric': 0.16758933064921994, 'fraction_numerical': 0.0, 'mean_word_length': 4.881656804733728, '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': '4286278', 'n_tokens_mistral': 639, 'n_tokens_neox': 609, 'n_words': 129}