0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00
ghost/core/shared
Daniel Lockyer f4fb0fcbaa Improved Ghost boot time and memory usage by lazy loading routes
no issue

- right now, we mount all API endpoints (v2, v3 and canary), alongside some
  other routes, when Ghost is booting. This is wasteful because we don't
  necessarily need any of the endpoints to get Ghost up and running
- even when Admin is used, it uses `canary` so `v2` and `v3` sit in memory
- the better approach here is to lazy load these endpoints, so they only
  get mounted when needed
- this commit adds the `lazyUse` function into our Express lib,
  which takes a mount path and a module function to execute down the
  line. This gets passed to the wonderful `express-lazy-router` lib which
  detects when we're calling an unmounted module and will mount it for
  us
- from local testing, this speeds up boot time by about 18% and reduces
  initial memory usage by about 6% 🚀
2021-10-15 17:52:07 +02:00
..
config Added offers UI in Portal 2021-10-15 11:50:27 +05:30
i18n Removed remaining usage of i18n & translation file 2021-10-15 11:39:07 +01:00
settings-cache Swapped to American English spellings 2021-08-09 13:35:01 +04:00
custom-theme-settings-cache.js Added syncing and theme exposure of custom theme settings (#13354) 2021-09-23 12:44:39 +01:00
express.js Improved Ghost boot time and memory usage by lazy loading routes 2021-10-15 17:52:07 +02:00
html-to-plaintext.js Added paywall card to mark end of free content preview (#12663) 2021-02-17 23:00:26 +00:00
labs.js Added basic {{match}} helper 2021-10-14 19:36:56 +01:00
sentry.js Fixed the version sent to Sentry 2021-05-17 13:32:56 +02:00
url-utils.js Updated to use config-url-helpers in urlUtils 2021-06-18 21:49:28 +01:00