Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions server/express/jest.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"preset": "ts-jest",
"testEnvironment": "node",
"roots": ["<rootDir>/src", "<rootDir>/tests"],
"testMatch": [
"**/__tests__/**/*.ts",
"**/?(*.)+(spec|test).ts"
],
"transform": {
"^.+\\.ts$": "ts-jest"
},
"collectCoverageFrom": [
"src/**/*.ts",
"!src/**/*.d.ts"
],
"coverageDirectory": "coverage",
"coverageReporters": [
"text",
"lcov",
"html"
],
"setupFilesAfterEnv": ["<rootDir>/tests/setup.ts"]
}
24 changes: 14 additions & 10 deletions server/express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@
"license": "Apache-2.0",
"author": "Jordan Smith",
"type": "commonjs",
"main": "dist/app.ts",
"main": "dist/app.js",
"scripts": {
"build": "tsc",
"start": "node dist/app.js",
"start": "node dist/src/app.js",
"dev": "ts-node src/app.ts",
"test-setup": "ts-node src/test-setup.ts",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage"
},
"dependencies": {
"express": "^5.1.0",
"mongodb": "^6.3.0",
"cors": "^2.8.5",
"dotenv": "^16.3.1",
"cors": "^2.8.5"
"express": "^5.1.0",
"mongodb": "^6.3.0"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.14",
"@types/node": "^20.10.5",
"@types/cors": "^2.8.17",
"typescript": "^5.3.3",
"ts-node": "^10.9.2"
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
}
}
14 changes: 14 additions & 0 deletions server/express/src/config/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,18 @@ async function verifyMoviesCollection(db: Db): Promise<void> {
if (movieCount === 0) {
console.warn('Movies collection is empty. Please ensure sample_mflix data is loaded.');
}

// Create text search index on plot field for full-text search
try {
await moviesCollection.createIndex(
{ plot: 'text', title: 'text', fullplot: 'text' },
{
name: 'text_search_index',
background: true
}
);
console.log('Text search index created for movies collection');
} catch (error) {
console.log('Could not create text search index.');
Comment thread
jordan-smith721 marked this conversation as resolved.
Outdated
}
}
Loading