Skip to content

Commit c2af0af

Browse files
Nathan Simpsonstennie
authored andcommitted
Reviewed Getting Started documentation (#4721)
- FIxed spelling, grammar and broken link issues with the Getting Started documentation. - Ensured that Keystone is capitalised everywhere in the docs - Set Mongoose docs link to V4
1 parent 6a651b7 commit c2af0af

26 files changed

+128
-116
lines changed

docs/Getting Started/Setting-Up/part-1.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
## Introduction
44

5-
If you want to jump right in to a working keystone codebase, check out our [quick start guide](/getting-started/yo-generator), which walks you through using our generator to get a keystone codebase up and running quickly. This tutorial will walk you through setting up a project, looking at what the core parts of keystone are and how to set them up.
5+
If you want to jump right in to a working Keystone codebase, check out our [quick start guide](/getting-started/yo-generator), which walks you through using our generator to get a Keystone codebase up and running quickly. This tutorial will walk you through setting up a project, looking at what the core parts of Keystone are and how to set them up.
66

77
This guide assumes you are familiar with using npm to install packages, and javascript as a language.
88

99
We're going to be tackling this in three parts.
1010

1111
Part 1 (this one here) will focus on installation and setting up our `keystone.js` file, which launch our app.
1212

13-
[Part 2](/getting-started/setting-up/part-2) will detail building keystone models and setting up your database.
13+
[Part 2](/getting-started/setting-up/part-2) will detail building Keystone models and setting up your database.
1414

15-
[Part 3](/getting-started/setting-up/part-3) will go through setting up routes with keystone to serve both database information as well as website pages.
15+
[Part 3](/getting-started/setting-up/part-3) will go through setting up routes with Keystone to serve both database information as well as website pages.
1616

1717
[Part 4](/getting-started/setting-up/part-4) will get a us a `POST` endpoint which we can use to post data to.
1818

@@ -21,20 +21,20 @@ Before we start, make sure you have [node](nodejs.org) and [mongo](https://www.m
2121
## Installation
2222
Start by creating a new directory and then from within it run `npm init`. This will set us up with a `package.json` for you with the ability to set up some default options.
2323

24-
Next, install keystone with `npm install --save keystone`.
24+
Next, install Keystone with `npm install --save keystone`.
2525

26-
At this point, we should have a `node_modules` directory and keystone should have been added to the `package.json`.
26+
At this point, we should have a `node_modules` directory and Keystone should have been added to the `package.json`.
2727

2828
## Initial Setup
2929

30-
Create a new file, `keystone.js` and we're ready to start configuring keystone.
30+
Create a new file, `keystone.js` and we're ready to start configuring Keystone.
3131

32-
Your `keystone.js` file is the launch file for keystone, which will connect keystone to your database, start both the database connection, and start your server running. This is where we will be adding configuration options to keystone as well, which allow us to change how keystone is running.
32+
Your `keystone.js` file is the launch file for Keystone, which will connect Keystone to your database, start the database connection, and start your server running. This is where we will be adding configuration options to Keystone as well, which allow us to change how Keystone is running.
3333

34-
The minimum file we need to start keystone running is:
34+
The minimum file we need to start Keystone running is:
3535

3636
```javascript
37-
var keystone = require('keystone');
37+
var keystone = require('Keystone');
3838

3939
keystone.init({
4040
'cookie secret': 'secure string goes here',
@@ -43,11 +43,11 @@ keystone.init({
4343
keystone.start();
4444
```
4545

46-
First we require keystone, then we run `keystone.init()`. This function sets up keystone's initial starting values. Here we are only providing it a cookie secret, however as we build up our application we are going to come back and add more options here. If you want to check out the full list of options, you can find them [here](/documentation/configuration).
46+
First we require Keystone, then we run `keystone.init()`. This function sets up Keystone's initial starting values. Here we are only providing it a cookie secret, however as we build up our application we are going to come back and add more options here. If you want to check out the full list of options, you can find them [here](/documentation/configuration).
4747

48-
A `cookie secret` is the only option that is technically required to launch keystone, however we'll be fleshing this out as we complete our setup.
48+
A `cookie secret` is the only option that is technically required to launch Keystone, however we'll be fleshing this out as we complete our setup.
4949

50-
Finally, we call `keystone.start()`, which kicks off our keystone app.
50+
Finally, we call `keystone.start()`, which kicks off our Keystone app.
5151

5252
We can now check this runs. Run `node keystone.js` and you should be greeted with:
5353

@@ -58,7 +58,11 @@ Keystone is ready on http://0.0.0.0:3000
5858
------------------------------------------------
5959
```
6060

61-
Unfortunately all that's there is a 404 error page. We're going to solve that in [part 3](/getting-started/setting-up/part-3). In [Part 2](/getting-started/setting-up/part-2) we are going to focus on getting the database connected, and the admin UI up and running. You can do these two in either order.
61+
You should get a 404 page. That's ok! That will be resolved in [part 3](/getting-started/setting-up/part-3) of this guide. In [Part 2](/getting-started/setting-up/part-2) we are going to focus on getting the database connected, and the admin UI up and running. You can do these two in either order.
62+
63+
## Next Steps
64+
Check out [part 2](/getting-started/setting-up/part-2) of this guide, which walks you through setting up your database, or if you want to read more about any of the parts we set up, you can check out these links:
65+
6266

6367
## Learn more about:
6468

docs/Getting Started/Setting-Up/part-2.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Firstly, we are going to add a `name`. This is used as the site name, and defaul
3535

3636
Next, we want to define what our `'user model'` will be. Let's call it `'User'` to keep it simple.
3737

38-
We want to set `auth` to be `true` so accessing the keystone admin UI requires a person to log in.
38+
We want to set `auth` to be `true` so accessing the Keystone admin UI requires a person to log in.
3939

4040
Finally we want to set `'auto update'` to be `true`. This is going to make it very easy to get our seed data in to our project.
4141

@@ -59,7 +59,7 @@ Finally, we are going to add a new line to the file, which is going to import ou
5959
keystone.import('models');
6060
```
6161

62-
The `import` method allows us to pull in an entire folder, in this case the entire models folder, and will allow us to add as many models as we want without having to come back and let keystone know we've added something new. New models will be noticed each time keystone starts.
62+
The `import` method allows us to pull in an entire folder, in this case the entire models folder, and will allow us to add as many models as we want without having to come back and let Keystone know we've added something new. New models will be noticed each time Keystone starts.
6363

6464
If you want to know more about `keystone.import()` the documentation is [here](/api/methods/import).
6565

@@ -110,7 +110,7 @@ This is our most basic field here. Every field needs a `type` property defined,
110110
password: { type: keystone.Field.Types.Password }
111111
```
112112

113-
Our email field is using a keystone-specific field type. This adds a defined shape to the data, as well as a collection of extra validation. For the password field, it will encrypt it for us. In addition, in the keystone admin UI, it will not display the contents of the password field, and will require a password to be entered twice to change it.
113+
Our email field is using a keystone-specific field type. This adds a defined shape to the data, as well as a collection of extra validation. For the password field, it will encrypt it for us. In addition, in the Keystone admin UI, it will not display the contents of the password field, and will require a password to be entered twice to change it.
114114

115115
This takes care of a lot of our password security for us.
116116

@@ -120,10 +120,9 @@ email: { type: keystone.Field.Types.Email, unique: true },
120120

121121
Email is similar to password in that it is using a keystone-specific field type, in this case to ensure that when this field is filled, it has the shape of an email. In addition, we have passed a second option of `unique: true`, which forces the field to be unique within the database. No doubling up on email addresses for accounts.
122122

123-
// The following para really needs more work. Needs lightness and timing
124-
If you want to know about all the field types keystone offers, you can find the information find the full list of options in the [field docs](/api/field) Also, for the options like `unique` which are available to all fields, you can read more [here](/api/field/options), for when you are making your own models.
123+
If you want to know about all the field types Keystone offers, you can find the full list of options in the [Field API documentation](/api/field) Also, for the options like `unique` which are available to all fields, you can read more about the [Field options API](/api/field/options), for when you are making your own models.
125124

126-
There are three more parts we are going to need to get our user model working. The first is to register it to keystone. This will tell keystone to include it in its list of models. To do this, add the following line to the bottom of the file:
125+
There are three more parts we are going to need to get our user model working. The first is to register it to keystone. This will tell Keystone to include it in its list of models. To do this, add the following line to the bottom of the file:
127126

128127
```javascript
129128
User.register();
@@ -169,7 +168,7 @@ User.register();
169168

170169
### Adding an update script
171170

172-
There's one more thing to do before we can launch our app. We need to have an initial user in our database. We can do this through an update script, which keystone will run on startup.
171+
There's one more thing to do before we can launch our app. We need to have an initial user in our database. We can do this through an update script, which Keystone will run on startup.
173172

174173
Make a new directory called `updates` and make a file `0.0.1-first-user.js` in it. Next we can just drop in the following code:
175174

@@ -186,7 +185,7 @@ exports.create = {
186185

187186
```
188187

189-
This will create a user with these details (though the password will be hashed before saving) when keystone is started up. If you want to know more about update scripts, you can find the information [here](/documentation/configuration).
188+
This will create a user with these details (though the password will be hashed before saving) when Keystone is started up. If you want to know more about update scripts, you can find the information [here](/documentation/configuration).
190189

191190
An important note is that you will likely end up committing your update scripts to your project, so you should not include sensitive information in here. Any passwords added in an update script should be manually changed afterwards.
192191

@@ -232,13 +231,13 @@ Event.register();
232231
```
233232

234233
## Next Steps
235-
Check out [part 3](/getting-started/setting-up/part-3) of our setting up keystone guide, which walks you through adding your own pages to your site, or if you want to read more about any of the parts we set up, you can check out these links:
234+
Check out [Part 3 : Routing](/getting-started/setting-up/part-3) of our setting up Keystone guide, which walks you through adding your own pages to your site, or if you want to read more about any of the parts we set up, you can check out these links:
236235

237-
learn more about:
236+
## Learn more about:
238237

239238
- [configuring keystone](/documentation/configuration)
240239
- [importing models](/api/methods/import)
241-
- [list of keystone fields](/api/field)
242-
- [keystone field options](/api/fields/options)
243-
- [update scripts](/documentation/application-updates)
240+
- [list of Keystone fields](/api/field)
241+
- [keystone field options](/api/field/options)
242+
- [update scripts](/documentation/database/application-updates)
244243
- [virtuals and schema methods](/api/list/schema)

docs/Getting Started/Setting-Up/part-3.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Part 3: Routing
22

3-
Keystone is designed to do much of the setup of running an [express](expressjs.com) application out of your hands as well as allowing an easy configuration of the options.
3+
Keystone is designed to do much of the setup of running an [ExpressJS](https://expressjs.com) application out of your hands as well as allowing an easy configuration of the options.
44

5-
Here we are going to add a router to our keystone application, and set up a basic webpage. This will not rely on what was done in part 2.
5+
Here we are going to add a router to our Keystone application, and set up a basic webpage. This will not rely on what was done in part 2.
66

77
After that, we are going to set up an API endpoint to retrieve information about the events model, which will be relying on setup we did in [Part 2](/getting-started/setting-up/part-2).
88

9-
For our routing, we are going to be using [pug](pugjs.org) to render our views, however the principles will remain the same for other view engines.
9+
For our routing, we are going to be using [pug](https://pugjs.org) to render our views, however the principles will remain the same for other view engines.
1010

1111
## Setup
1212

@@ -39,7 +39,7 @@ If you did [part 2](/getting-started/setting-up/part-2), you will have more than
3939

4040
As we mentioned in part one, keystone.init allows us to define our initial options for keystone's startup. For configuring our database connection, we are going to add 2 new properties to our `keystone.init`, and then add a line that will import our routes.
4141

42-
Our two properties are `views` and `view engine`. The first allows us to set a folder location relative to `keystone.js` to load our view files from. The second sets an engine for keystone to try and render the files with.
42+
Our two properties are `views` and `view engine`. The first allows us to set a folder location relative to `keystone.js` to load our view files from. The second sets an engine for Keystone to try and render the files with.
4343

4444
We are going to want to set them as:
4545

@@ -64,7 +64,7 @@ Keystone will look for an installed npm package with the same name as the view e
6464
$ npm install --save pug
6565
```
6666

67-
Finally, we need to add a line to tell keystone where we plan to write our routes.
67+
Finally, we need to add a line to tell Keystone where we plan to write our routes.
6868

6969
```javascript
7070
keystone.set('routes', require('./routes'));
@@ -92,7 +92,7 @@ The reason for this structure is that it is best to keep the individual routes i
9292

9393
Let's fill out our central file, our `routes/index.js`.
9494

95-
This file is going to export a function, takes in the express app keystone has built for us, and adds on our individual routes.
95+
This file is going to export a function, takes in the express app Keystone has built for us, and adds on our individual routes.
9696

9797
The most basic form of it would look like:
9898

@@ -119,7 +119,7 @@ exports = module.exports = function (app) {
119119
};
120120
```
121121

122-
The keystone importer gives us a function that allows us to reduce a folder and its contents to an object with the same nesting.
122+
The Keystone importer gives us a function that allows us to reduce a folder and its contents to an object with the same nesting.
123123

124124
We then call `importRoutes` with the directory we want to import, and attach it to an object at `routes.views`. Finally, we can now provide `routes.views.index` as the second argument for our `app.get` function call.
125125

@@ -180,18 +180,18 @@ html(lang="en")
180180
Hope you're enjoying learning about keystone. We're close to some very dynamic cool things
181181
```
182182

183-
Check out [pugjs.org](pugjs.org) if you want to know more about pug.
183+
Check out [pugjs.org](https://pugjs.org) if you want to know more about pug.
184184

185-
Now, if we start our keystone app using `node keystone`, we should be able to visit the homepage and see it rendered!
186-
187-
[Part 4](/getting-started/setting-up/part-4)
185+
Now, if we start our Keystone app using `node keystone`, we should be able to visit the homepage and see it rendered!
188186

189187
## Next Steps
188+
Check out [part 4](/getting-started/setting-up/part-4) of our setting up Keystone guide, which walks you through setting up an API endpoint so we can record data to our database from a form.
189+
190190

191-
Learn more about:
191+
## Learn more about:
192192

193-
- [keystone.set](/methods/set)
194-
- [init options](/configuration)
195-
- [pug](pugjs.org)
196-
- [express](expressjs.com)
197-
- [keystone.importer](/methods/importer)
193+
- [keystone.set](/api/methods/set)
194+
- [init options](/documentation/configuration)
195+
- [pug](https://pugjs.org)
196+
- [express](https://expressjs.com)
197+
- [keystone.importer](/api/methods/importer)

docs/Getting Started/Setting-Up/part-4.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ Your source tree should look like the following:
6060
|--keystone.js
6161
```
6262

63-
## Adding a `addEvent` view
63+
## Adding an `addEvent` view
6464

65-
First we want our pair of new files to make up the route and the view, these should be `routes/views/addEvent` and `templates/views/addEvent.pug`.
65+
First we want our pair of new files to make up the route and the view. These should be `routes/views/addEvent` and `templates/views/addEvent.pug`.
6666

67-
As we are not a pug tutorial, here's a page we prepared earlier:
67+
As this is not a pug tutorial, here's a page we prepared earlier:
6868

6969
```jade
7070
doctype html
@@ -127,7 +127,7 @@ With all this, we can start keystone, and go to our new route, and fill out the
127127

128128
We are going to create a new addition to our app, a handler for a post request, and then a request handler that can save the event information back to our database.
129129

130-
As this endpoint is not a view, we are going to have to modify our routes object. We are going to create a new folder to importRoutes from, called `api`. Beofre this though, let us set up our `routes/index` for it.
130+
As this endpoint is not a view, we are going to have to modify our routes object. We are going to create a new folder to importRoutes from, called `api`. Before this though, let us set up our `routes/index` for it.
131131

132132
First, we want to add a second property to our routes object to read in our api folder. Our routes object should end up looking like:
133133

@@ -186,7 +186,7 @@ First, we can create a new item, passing in values we want to use as our initial
186186
var newEvent = new Event(req.body);
187187
```
188188

189-
This will return us an object with the properties of an Event from our schema however it has not yet been saved. You can use `newEvent.save()`, which implements mongoose's save method, however keystone provides an `updateItem` function that runs keystone's validators, to make sure the data in the fields complies with keystone's full schema. Yes, updateItem will create an item if it does not exist.
189+
This will return us an object with the properties of an Event from our schema however it has not yet been saved. You can use `newEvent.save()`, which implements mongoose's save method, however Keystone provides an `updateItem` function that runs keystone's validators, to make sure the data in the fields complies with keystone's full schema. Yes, updateItem will create an item if it does not exist.
190190

191191
We can call this like so:
192192

@@ -225,6 +225,15 @@ Event.updateItem(newEvent, req.body, function (error) {
225225
});
226226
```
227227

228-
## Next Steps
228+
## Congratulations
229+
Well done! You have finished this four-step guide to getting started with Keystone, and you now have a basic Keystone app, complete with an API for form handling that adds data to our database. For more information on list options and the field types Keystone supports, browse the [database guide](/documentation/database/).
230+
231+
You should also [Follow @KeystoneJS on Twitter](https://twitter.com/keystonejs) for news and updates, [Star KeystoneJS on GitHub](https://github.com/keystonejs/keystone), and discuss this guide (or anything KeystoneJS related) on the [KeystoneJS Google Group](https://groups.google.com/d/forum/keystonejs).
229232

230-
- [updateItem](/api/list/update-item)
233+
Enjoy using KeystoneJS!
234+
235+
## Next Steps
236+
- [Guides](/guides)
237+
- [Documentation](/documentation)
238+
- [api](/api)
239+
- [updateItem](/api/list/update-item)

0 commit comments

Comments
 (0)