diff --git a/packages/backend/src/core/TutorialService.ts b/packages/backend/src/core/TutorialService.ts index 5c9722e37..41086b374 100644 --- a/packages/backend/src/core/TutorialService.ts +++ b/packages/backend/src/core/TutorialService.ts @@ -6,16 +6,18 @@ export class TutorialService { try { const files = fs.readdirSync('src/content/tutorials') - return files.map((filename) => { - const filenameWithoutExt = filename.replace('.md', '') - return { - title: filenameWithoutExt.replaceAll('-', ' '), - imageUrl: `/images/${filenameWithoutExt}.jpg`, - slug: filenameWithoutExt.toLowerCase(), - } - }) + return files.map(this.toTutorialEntry) } catch { return [] } } + + private toTutorialEntry(filename: string): HomeTutorialEntry { + const filenameWithoutExt = filename.replace('.md', '') + return { + title: filenameWithoutExt.replaceAll('-', ' '), + imageUrl: `/images/${filenameWithoutExt}.jpg`, + slug: filenameWithoutExt.toLowerCase(), + } + } }