From 50e08ff7a66985a70b53113c525414dd2c159769 Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Fri, 4 Jun 2021 21:07:14 -0600 Subject: [PATCH 1/5] Update commands in installation descriptions --- lib/content/getting-started.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/content/getting-started.md b/lib/content/getting-started.md index 71b373e..5aeefb9 100644 --- a/lib/content/getting-started.md +++ b/lib/content/getting-started.md @@ -44,11 +44,11 @@ git add --all git commit -m "Initial commit" ``` -On running `npx hpal new paldo-riddles`, you'll be prompted with the [`npm init`](https://docs.npmjs.com/cli/init) dialog, where you can enter details about your project that will go into its `package.json` file. Feel free to take the time to fill-out the details, or just "enter" all the way through—either is fine for the purposes of this tutorial. +On running `npm init @hapipal paldo-riddles`, you'll be prompted with the [`npm init`](https://docs.npmjs.com/cli/init) dialog, where you can enter details about your project that will go into its `package.json` file. Feel free to take the time to fill-out the details, or just "enter" all the way through—either is fine for the purposes of this tutorial. You now have a base pal project directory ready to go! -`npx hpal new paldo-riddles` calls hapi pal's command line utility [hpal](https://www.npmjs.com/package/@hapipal/hpal) to bootstrap a new project in a directory titled `paldo-riddles` in our current working directory (the argument to `new` is a path). +`npm init @hapipal paldo-riddles` calls hapi pal's command line utility [hpal](https://www.npmjs.com/package/@hapipal/hpal) to bootstrap a new project in a directory titled `paldo-riddles` in our current working directory (the argument to `new` is a path). We'll cover more on `hpal` in just a bit. @@ -370,7 +370,7 @@ If you used the hpal CLI to start your project as described above, run: git cherry-pick objection ``` -If you cloned the pal repo (rather than using `npx hpal new ...`), you'll need to fetch the tagged commits first: +If you cloned the pal repo (rather than using `npm init @hapipal paldo-riddles`), you'll need to fetch the tagged commits first: ```sh git fetch pal --tags From c210c8d9d4345b48a1a187f97f32e4bb67c510d3 Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Fri, 4 Jun 2021 21:10:57 -0600 Subject: [PATCH 2/5] Update riddle-random exapmle following linting rules --- lib/content/getting-started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/content/getting-started.md b/lib/content/getting-started.md index 5aeefb9..2026f92 100644 --- a/lib/content/getting-started.md +++ b/lib/content/getting-started.md @@ -207,8 +207,8 @@ module.exports = { slug: 'no-body', question: 'I have a head & no body, but I do have a tail. What am I?', answer: 'A coin' - }, - // etc. + } + // etc. ]; // And we reply randomly From 10db73571525e3637c38268512ce3262cc37cf24 Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Fri, 4 Jun 2021 21:28:50 -0600 Subject: [PATCH 3/5] Update curl commands and browser links to be more consistent --- lib/content/getting-started.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/content/getting-started.md b/lib/content/getting-started.md index 2026f92..bda6f2b 100644 --- a/lib/content/getting-started.md +++ b/lib/content/getting-started.md @@ -93,7 +93,7 @@ Debug: start Server started at http://localhost:3000 ``` -If you then visit that address in your browser or cURL it (`curl http://localhost:3000`), you should receive the following: +If you then visit that address [in your browser](http://localhost:3000) or cURL it (`curl http://localhost:3000`), you should receive the following: ```json { @@ -224,7 +224,7 @@ module.exports = { Be sure to restart your server in order to pick-up this new code. -If you cURL our new route (`curl http://localhost:3000/riddle-random`) or visit it [in your browser](http://localhost:3000/riddle-random), you'll see one of Paldo's riddles. We're up and running! +If you cURL our new route (`curl http://localhost:3000/riddle-random`) or visit it [in your browser](http://localhost:3000/riddle-random), we'll see one of Paldo's riddles. We're up and running! Now, let's setup letting people get answers if (well, when :)), they get stumped. We'll rely on Paldo's friends supplying the `slug` of the riddle they're stuck on (for now) to know which answer to supply. @@ -318,11 +318,7 @@ module.exports = { }; ``` -Now, passing any riddle's `slug`s here returns its answer. -```sh -# Use a slug from your project -curl http://localhost:3000/riddle-answer/no-body -``` +After restarting your server, we may cURL our new route with a `slug` (`curl http://localhost:3000/riddle-answer/no-body`) or visit it [in your browser](http://localhost:3000/riddle-answer/no-body) and we'll see the answer associated with the `slug`. ## Aside: Linting From 8d063a24e2bd2e4bf7bfa3fac3840eacf3e0ae75 Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Fri, 4 Jun 2021 22:32:17 -0600 Subject: [PATCH 4/5] Add note about prepopulated database issues --- lib/content/getting-started.md | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/content/getting-started.md b/lib/content/getting-started.md index bda6f2b..9ec2504 100644 --- a/lib/content/getting-started.md +++ b/lib/content/getting-started.md @@ -443,6 +443,7 @@ The main takeaway from here is that, out of the box, we get an in-memory databas > > In fact, there's already a sqlite database, prepopulated with a handful of riddles, [available in the example application repo](https://github.com/hapipal/examples/blob/master/paldo-riddles/riddles.db). As an exercise for the reader, try setting `filename` with an environment variable (as would usually be done in a production deployment (and how the examples repo is setup)) > +> NOTE: using the prepopulated database may error because the migration scripts likely don't exist. From 28cb20ac06b4e9eeae3d90eca8691096d46e5b93 Mon Sep 17 00:00:00 2001 From: Michael Tuttle Date: Fri, 4 Jun 2021 22:32:51 -0600 Subject: [PATCH 5/5] Remove non-existent log line from migration example --- lib/content/getting-started.md | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/content/getting-started.md b/lib/content/getting-started.md index 9ec2504..4d439ef 100644 --- a/lib/content/getting-started.md +++ b/lib/content/getting-started.md @@ -585,7 +585,6 @@ If all's gone well, you should see: ```sh Batch 1 run: 1 migrations -/your/local/path/paldo-riddles/lib/migrations/20180226173134_add-riddles.js ``` At long last, we're ready to start working with our data.