You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
830 B

  1. import fs from 'node:fs'
  2. type section = {
  3. title : string;
  4. href?: string;
  5. content?: string;
  6. }
  7. let sections = <section[]>[
  8. {title : "home", href: "#home"},
  9. {title : "bio", href: "#bio"},
  10. {title : "musique", href: "#musique"},
  11. {title : "vidéos", href: "https://videos.cassidypunchmachine.com/c/cassidy/videos"},
  12. {title : "artworks", href: "#artworks"},
  13. {title : "live", href: "#live"},
  14. {title : "contact", href: "#contact"},
  15. ]
  16. //feed section with html contents only if ${title}.html file exists
  17. sections.map((s) => {
  18. let path = `./server/api/${s.title}.html`
  19. if(fs.existsSync(path))
  20. s.content = fs.readFileSync(path,{encoding:'utf8', flag:'r'});
  21. })
  22. export default defineEventHandler((event) => {
  23. return {
  24. sections : sections
  25. }
  26. }
  27. )