Hook Tutorial

WARNING! v0.13 was just released, and the tutorial is currently undergoing final testing. It's recommended that you DO NOT follow along until this message is removed (please check back tomorrow).

A tutorial for learning to create your own hooks

Step 1: Clone Starter Project

In this step we'll clone and run repository we'll be adding a custom hook to.

Clone the Repo

First clone the repo containing the starter code for this tutorial.

$ git clone git@github.com:lore/lore-hook-tutorial.git
$ git clone https://github.com/lore/lore-hook-tutorial.git

NOTE: The written code in this tutorial will be displayed in both ES5 and ES6 syntax, but the code in the repository was written in ES6. If that causes any trouble or confusion for you, please file an issue on GitHub.

Switch Branch to Step-1

The code for the beginning of the tutorial is in the step-1 branch, so check out that branch to follow along with the tutorial.

$ git checkout step-1

Install the Dependencies

Next install the dependencies:

npm install

Start the API Server

Just like the Quickstart, this project uses json-server to provide us with a real API interface. Run this to command to start the server:

npm run server

Once the server is running, you should be able to navigate to http://localhost:1337 and see a list of API endpoints.

Build the Project

Finally, run this command to build the project and start the development server:

npm start

Once the project is built, open a web browser and visit http://localhost:3000.

Visual Check-in

If everything went well, you should see this in your browser.

Next Steps

Next we're going to generate the hook.