Skip to content

Commit 640edde

Browse files
Updates (#7)
* 1.1.1 * Update copy
1 parent c484dc3 commit 640edde

File tree

9 files changed

+32
-33
lines changed

9 files changed

+32
-33
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cf-tutor",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/categories/ai.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,11 @@ ${chalk.green(`//Todo - add default function`)}
4545
`;
4646

4747
const workerCodeBlock2 = `
48-
${chalk.blue(' export default {')}
48+
${chalk.blue('export default {')}
4949
${chalk.blue(' async fetch(request, env): Promise<Response> {')}
50-
${chalk.blue(` const response = await env.AI.run('@cf/meta/llama-3.1-8b-instruct',`)}
51-
${chalk.blue(' prompt: "What is the origin of the phrase Hello, World"')}
52-
${chalk.blue(` }`)}
53-
${chalk.blue(` );`)}
50+
${chalk.blue(` const response = await env.AI.run("@cf/meta/llama-3.1-8b-instruct", {`)}
51+
${chalk.blue(' prompt: "What is the origin of the phrase Hello, World",')}
52+
${chalk.blue(` });`)}
5453
${chalk.blue(``)}
5554
${chalk.blue(` return new Response(JSON.stringify(response));`)}
5655
${chalk.blue(` },`)}
@@ -99,12 +98,12 @@ export const aiQuiz: Quiz = {
9998
correctAnswer: '',
10099
},
101100
{
102-
question: `\n${intro2} \n\nLet's create a Worker that can send a prompt to a Large Language Model and recieve a response from the model. We will also look at how to instruct the model to respond in a specified way.\n\nPress 'enter' to continue\n\n`,
101+
question: `\n${intro2} \n\nLet's create a Worker that can send a prompt to a Large Language Model and recieve a response from the model. We will also look at how to instruct the model to respond in a specified way.\n\nPress 'Enter' to continue\n\n`,
103102
type: 'text',
104103
correctAnswer: '',
105104
},
106105
{
107-
question: `\n${intro3} \n\nTo do this, we will first create our Worker that will query the AI models available on Cloudflare. In this terminal below, enter the following to create your worker: \n${c3command}\nAfter running this command, for the purposes of this tutorial you want to select the following options:\n\n 1. Directory/application name: ai-cli-tutorial\n 2. Create a Hello World Worker\n 3. Select Typescript\n 4. No to connecting to Github\n 5. No to Deploying\n\n`,
106+
question: `\n${intro3} \n\nTo do this, we will first create our Worker that will query the AI models available on Cloudflare. In this terminal below, enter the following to create your worker: \n${c3command}\nAfter running this command, for the purposes of this tutorial you want to select the following options:\n\n 1. Directory name: ai-cli-tutorial\n 2. Category: Hello World example\n 3. Template: Hello World Worker\n 3. Language: Typescript\n 5. No to Deploying\n\n`,
108107
type: 'text',
109108
correctAnswer: 'npm create cloudflare',
110109
npmCommand: ['npm', 'create', 'cloudflare']

src/categories/aiChallenge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const aiChallenge: Quiz = {
2525
}
2626
,
2727
{
28-
question: `\n${intro2}\n\nYou can complete this challenge in two different ways:\n\nLocally:\nCreate a local version of your database, then open a second command terminal run your Worker locally. Once your local Worker is running, enter the curl command in this terminal to access it. In this case, the curl command should look something like this: curl http://*local-host-number*\n\nRemotely:\nDeploy your databaase and Worker remotely, then enter the curl command to access your deployed Worker in this terminal.\n\nThe CURL command should look something like this (Remember to replace *your-worker-name* with your Worker): curl https://*your-worker-name*.workers.dev\n\nYou will be able to use this terminal to interact with C3 and Wrangler, change directory and enter the CURL command to recieve responses from your Worker. Press Enter to start the challenge.`,
28+
question: `\n${intro2}\n\nYou can complete this challenge in two different ways:\n\nLocally:\nCreate a local version of your database, then open a second command terminal to run your Worker locally. Once your local Worker is running, enter the cURL command in this terminal to access it. In this case, the cURL command for a locally hosted Worker should look something like this: curl http://*local-host-number*\n\nRemotely:\nDeploy your databaase and Worker remotely, then enter the cURL command to access your deployed Worker in this terminal.\n\nThe CURL command for a remotely deployed Worker should look something like this: curl https://*your-worker-name*.workers.dev\n\nYou will be able to use this terminal to interact with C3 and Wrangler, change directory and enter the CURL command to recieve responses from your Worker. Press Enter to start the challenge.`,
2929
type: 'text',
3030
correctAnswer: '',
3131
}

src/categories/c3.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const c3Quiz: Quiz = {
7272
},
7373
{
7474

75-
question: `\n${intro2} \n\nFirst we are going to create our Worker project. We will achieve this using C3 (create-cloudflare-cli). C3 is Cloudflare's CLI tool designed to create Cloudflare applications and set up scaffolding for different types of projects.\n\nType the following command in your terminal to install the package: \n\n ${c3command}\n\nAfter running this command, for the purposes of this tutorial you want to enter the following options:\n\n 1. Directory name: cli-tutorial-worker\n 2. Select Hello World Worker\n 3. Select JavaScript\n 4. Select no to connecting to Github\n 5. Select no to Deploying\n\n`,
75+
question: `\n${intro2} \n\nFirst we are going to create our Worker project. We will achieve this using C3 (create-cloudflare-cli). C3 is Cloudflare's CLI tool designed to create Cloudflare applications and set up scaffolding for different types of projects.\n\nType the following command in your terminal to install the package: \n\n ${c3command}\n\nAfter running this command, for the purposes of this tutorial you want to enter the following options:\n\n 1. Directory name: cli-tutorial-worker\n 2. Category: Hello World example\n 3. Template: Hello World Worker\n 4. Language: JavaScript\n 5. Select no to deploying\n\n`,
7676
type: 'text',
7777
correctAnswer: 'npm create cloudflare',
7878
npmCommand: ['npm', 'create', 'cloudflare'],
@@ -103,7 +103,7 @@ export const c3Quiz: Quiz = {
103103
}
104104
,
105105
{
106-
question: `\n${intro6}\n\nOnce you're happy with the result you can then deploy your Worker to be available globally on the cloud. To do this, enter ${wranglerDeploy}'.\n\n`,
106+
question: `\n${intro6}\n\nOnce you're happy with the result you can then deploy your Worker to be available globally on the cloud. To do this, enter ${wranglerDeploy}\n\n`,
107107
type: 'text',
108108
correctAnswer: 'npx wrangler deploy',
109109
npmCommand: ['npx', 'wrangler', 'deploy']

src/categories/d1.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ ${chalk.blue(` .all();`)}
7070
${chalk.blue(` return Response.json(results);`)}
7171
${chalk.blue(` }`)}
7272
${chalk.blue(` return new Response(`)}
73-
${chalk.blue(` "Call /api/queen to see all Queen albums on the database"`)}
73+
${chalk.blue(` "Add /api/queen to the end of the localhost address above to see all Queen albums on the database"`)}
7474
${chalk.blue(` );`)}
7575
`;
7676

@@ -102,23 +102,23 @@ export const d1Quiz: Quiz = {
102102
category: 'Intro to D1',
103103
questions: [
104104
{
105-
question: `\n${intro}\n\nIn this walkthrough, you will learn the following: \n\n - What is D1? \n\n - How to create a D1 database through a CLI \n\n - How to query the D1 database using a Worker \n\nTo get started, press 'enter'\n\n`,
105+
question: `\n${intro}\n\nIn this walkthrough, you will learn the following: \n\n - What is D1? \n\n - How to create a D1 database through a CLI \n\n - How to query the D1 database using a Worker \n\nTo get started, press 'Enter'\n\n`,
106106
type: 'text',
107107
correctAnswer: ''
108108
},
109109
{
110-
question: `\n${intro1}\n\nD1 is Cloudflare’s serverless relational SQL database. Relational databases can be used to store vast amounts of data that are related to one another, such as a student name and the course they are attending.\n\nCommands called SQL queries can then be used to perform tasks utilizing this data, such as only searching for students who attend a specific course.\n\nPress 'enter' to continue.\n\n`,
110+
question: `\n${intro1}\n\nD1 is Cloudflare’s serverless relational SQL database. Relational databases can be used to store vast amounts of data that are related to one another, such as a student name and the course they are attending.\n\nCommands called SQL queries can then be used to perform tasks utilizing this data, such as only searching for students who attend a specific course.\n\nPress 'Enter' to continue.\n\n`,
111111
type: 'text',
112112
correctAnswer: '',
113113
},
114114
{
115115

116-
question: `\n${intro2} \n\nGerard recently set up a record store, but quickly realised they are having great difficulty organizing and keeping track of their current stock. They've asked you to help create a database that can keep track of the following:\n\n - Album name \n\n - Artist name \n\n - Year of release \n\nPress 'enter' to continue\n\n`,
116+
question: `\n${intro2} \n\nGerard recently set up a record store, but quickly realised they are having great difficulty organizing and keeping track of their current stock. They've asked you to help create a database that can keep track of the following:\n\n - Album name \n\n - Artist name \n\n - Year of release \n\nPress 'Enter' to continue\n\n`,
117117
type: 'text',
118118
correctAnswer: '',
119119
},
120120
{
121-
question: `\n${intro3} \n\nTo do this, we will first create our Worker that will be used to query the database. In this terminal below, enter the following to create your worker: \n${c3command}\nAfter running this command, for the purposes of this tutorial you want to select the following options:\n\n 1. Directory/application name: d1-cli-tutorial\n 2. Create a Hello World Worker\n 3. Select Typescript\n 4. No to connecting to Github\n 5. No to Deploying\n\n`,
121+
question: `\n${intro3} \n\nTo do this, we will first create our Worker that will be used to query the database. In this terminal below, enter the following to create your worker: \n${c3command}\nAfter running this command, for the purposes of this tutorial you want to enter the following options:\n\n 1. Directory name: d1-cli-tutorial\n 2. Category: Hello World example\n 3. Template: Hello World Worker\n 4. Language: Typescript\n 5. No to Deploying\n\n`,
122122
type: 'text',
123123
correctAnswer: 'npm create cloudflare',
124124
npmCommand: ['npm', 'create', 'cloudflare']
@@ -142,13 +142,13 @@ export const d1Quiz: Quiz = {
142142
}
143143
,
144144
{
145-
question: `\n${intro4}\n\nNow that you have created your D1 database above, you should have recieved an output that contains the array [[d1_databases]] followed by a binding variable, database_name variable and database_id variable. These details are used to establish a binding.\nA binding is a way of connecting Cloudflare resources together so that they can interact. By binding our Worker to the D1 database, they will be able to communicate with each other.\n\n In your IDE (Integrated Development Environment), Navigate to your wrangler.toml file and copy and paste the binding details that were outputted above into there. The file should already contain comments as examples for what it should look like and where the D1 binding should go.\n\nWhen you have completed this task, type 'done'\n\n`,
145+
question: `\n${intro4}\n\nNow that you have created your D1 database above, you should have recieved an output that contains the array [[d1_databases]] followed by a binding variable, database_name variable and database_id variable. These details are used to establish a binding.\nA binding is a way of connecting Cloudflare resources together so that they can interact. By binding our Worker to the D1 database, they will be able to communicate with each other.\n\n In your IDE (Integrated Development Environment), Navigate to your wrangler.toml file which should be located at cf-tutor/d1-cli-tutorial/wrangler.toml and copy and paste the binding details that were outputted above into the file. The wrangler.toml file should already contain comments as examples for what a binding should look like and where the D1 binding should go.\n\nWhen you have completed this task, type 'done'\n\n`,
146146
type: 'text',
147147
correctAnswer: 'done',
148148
}
149149
,
150150
{
151-
question: `\n${intro5}\n\nOur Worker and our D1 database are now connected. Next, let's add a table to our D1 database. A table holds rows of specified data. A relational database can contain multiple tables for different categories of data. For this exercise, we will create one table titled 'Records' that contains fields for the data ID, album name, album year and artist name.\n\nPress 'enter' to continue.`,
151+
question: `\n${intro5}\n\nOur Worker and our D1 database are now connected. Next, let's add a table to our D1 database. A table holds rows of specified data. A relational database can contain multiple tables for different categories of data. For this exercise, we will create one table titled 'Records' that contains fields for the data ID, album name, album year and artist name.\n\nPress 'Enter' to continue.`,
152152
type: 'text',
153153
correctAnswer: '',
154154
}
@@ -174,7 +174,7 @@ export const d1Quiz: Quiz = {
174174
}
175175
,
176176
{
177-
question: `\n${intro7}\n\nNext, let's expand our Worker so that it can query the database for us. Let's try and make this Worker capable of querying select bands depending on the URL path that the Worker is accessed with.\n\nWe'll go through this step by step.\n\n 1. Go to your IDE and navigate to the cf-tutor/d1-cli-tutorial/src folder.\nThen, open the index.ts file, delete everything in it\n 3. Copy and paste the below code block into it.\n\nThese lines of script establish the D1 binding in this file so that we can refer to it in functions.\n\n ${workerCodeBlock1}\n\nType 'done' when you are finished\n\n`,
177+
question: `\n${intro7}\n\nNext, let's expand our Worker so that it can query the database for us. Let's try and make this Worker capable of querying select bands depending on the URL path that the Worker is accessed with.\n\nWe'll go through this step by step.\n\n 1. Go to your IDE and navigate to the cf-tutor/d1-cli-tutorial/src folder.\n 2. Open the index.ts file and delete everything in it\n 3. Copy and paste the below code block into it.\n\nThese lines of script establish the D1 binding in this file so that we can refer to it in functions.\n\n ${workerCodeBlock1}\n\nType 'done' when you are finished\n\n`,
178178
type: 'text',
179179
correctAnswer: 'done',
180180
}

src/categories/d1Challenge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const d1Challenge: Quiz = {
3434
}
3535
,
3636
{
37-
question: `\n${intro2}\n\nYou can complete this challenge in two different ways:\n\nLocally:\nCreate a local version of your database, then open a second command terminal run your Worker locally. Once your local Worker is running, enter the curl command in this terminal to access it. In this case, the curl command should look something like this: curl http://*local-host-number*/api/companies\n\nRemotely:\nDeploy your databaase and Worker remotely, then enter the curl command to access your deployed Worker in this terminal.\n\nThe CURL command should look something like this (Remember to replace *your-worker-name* with your Worker): curl https://*your-worker-name*.workers.dev/api/companies\n\nYou will be able to use this terminal to interact with C3 and Wrangler, change directory and enter the CURL command to recieve responses from your Worker. Press Enter to start the challenge.`,
37+
question: `\n${intro2}\n\nYou can complete this challenge in two different ways:\n\nLocally:\nCreate a local version of your database, then open a second command terminal to run your Worker locally. Once your local Worker is running, enter the cURL command in this terminal to access it. In this case, the cURL command for a locally hosted Worker should look something like this: curl http://*local-host-number*/api/companies\n\nRemotely:\nDeploy your databaase and Worker remotely, then enter the cURL command to access your deployed Worker in this terminal.\nThe cURL command for a remote Worker should look something like this: curl https://*your-worker-name*.workers.dev/api/companies\n\nYou will be able to use this terminal to interact with C3 and Wrangler, change directory and enter the CURL command to recieve responses from your Worker. Press Enter to start the challenge.`,
3838
type: 'text',
3939
correctAnswer: '',
4040
}

0 commit comments

Comments
 (0)