0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00
ghost/core/server
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
..
adapters Replaced i18n.t w/ tpl helper in scheduler-intergation (#13399) 2021-10-01 10:38:13 +01:00
api Fixed duplicate message due to bad merge 2021-10-13 09:17:01 +01:00
data Added image as an allowed custom theme setting type 2021-10-14 18:41:54 +01:00
lib Refactored tpl to never be used in DI 2021-10-11 15:19:54 +01:00
models Added OfferRedemption model 2021-10-15 16:56:04 +02:00
public Added /email/ route to robots.txt 2021-08-10 13:45:53 +04:00
services Passed OfferRedemption to members 2021-10-15 16:56:04 +02:00
views
web Improved Ghost boot time and memory usage by lazy loading routes 2021-10-15 17:52:07 +02:00
analytics-events.js Added comments to all usages of lib/common/events 2021-07-07 16:02:44 +01:00
ghost-server.js Switch to @tryghost/debug, remove ghost-ignition 2021-06-15 17:24:22 +01:00
notify.js Change to use @tryghost/logging 2021-06-15 15:59:11 +01:00
overrides.js
run-update-check.js Removed remaining usage of i18n & translation file 2021-10-15 11:39:07 +01:00
update-check.js Fixed critical alerts sending to admin users 2021-07-07 11:29:18 +04:00