Skip to content

Instantly share code, notes, and snippets.

View max8hine's full-sized avatar
🎯
Focusing

Max Ma max8hine

🎯
Focusing
View GitHub Profile
@max8hine
max8hine / views_in_keystone.md
Created April 6, 2018 05:24 — forked from wuhaixing/views_in_keystone.md
How to Construct Yourself UI in KeystoneJS

#How to Construct Yourself UI in KeystoneJS

KeystoneJS provide Admin UI with one set of route controllers and view templates(list&item) for all of the models.But usually,you will need some custome views other than Admin UI to display models. Although the KeystoneJS documention don't tell us much about how to contruct custome view,we can learn this from the source code in skeleton project generated by yo keystone,or you can just check out the keystone demo project's source code.We will walk through the blog feature's implementation in this demo application to demonstrate how to construct custome UI in KeystoneJS application.

As KeystoneJS documention described in Routes & Views section,there is a routes/index.js file, where we bind application's URL patterns to the controllers that load and process data, and render the appropriate template.You can find following code in it:

app.get('/blog/:catego