Ghost: Add ability to upload+reload routes.yaml

Created on 20 Jul 2018  路  4Comments  路  Source: TryGhost/Ghost

We haven't announced Dynamic Routing Beta yet, but you can already read through this issue and read what Dynamic Routing is and how it works 馃

We would like to add the ability to upload the routes.yaml file in the admin panel. We will add a new form under Labs (very similar to the redirects upload form).

When the file was successfully uploaded, Ghost will reload all site routes based on your new routes.yaml version/file. A server restart won't be required.

This sub-feature will be available in Ghost 2.0.

Tasks

  • [x] reload express site app after the routes.yaml file was uploaded
  • [x] add proper error handling e.g. what if you upload a broken routes.yaml file - use backup and return a proper message to the user
  • [x] add simple UI @kevinansfield
  • [x] add more tests
  • [x] create backup (use the same strategy as for redirects)
admin client feature server / core

Most helpful comment

@kirrg001 PR for the UI is here, I've also created a 2.0 branch in Ghost-Admin with this commit already merged. Code is completely untested so far because I couldn't see that the endpoints were implemented anywhere yet 馃槃

All 4 comments

Endpoints:

I am following the convention of our redirect uploads.

POST /routes/yaml
GET /routes/yaml

Alternative is

POST /settings/routes/yaml
GET /settings/routes/yaml

The routes.yaml file is currently treated as "extra" blog setting - just file based. Furthermore, the routes.yaml file is completely handled in our settings service.

Maybe it's better to stay consistent for now and use this route notation.

@kirrg001 PR for the UI is here, I've also created a 2.0 branch in Ghost-Admin with this commit already merged. Code is completely untested so far because I couldn't see that the endpoints were implemented anywhere yet 馃槃

This issue can be closed. All tasks are done. Final QA/testing will happen soon.

Was this page helpful?
0 / 5 - 0 ratings