-
Notifications
You must be signed in to change notification settings - Fork 38
fix(app-typescript): add expected output and troubleshooting to writi… #446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,19 +49,83 @@ Run the file using `ts-node` to view the result: | |
| ts-node {lab-file} | ||
| ---- | ||
|
|
||
| You can check the result in the Neo4j Browser by running the following query: | ||
| If successful, you should see output similar to the following (with your name instead of "Your Name"): | ||
|
|
||
| .Expected Output | ||
| [source,json,role=nocopy] | ||
| ---- | ||
| { | ||
| identity: Integer { low: 12345, high: 0 }, | ||
| labels: [ 'Person' ], | ||
| properties: { name: 'Your Name' }, | ||
| elementId: '4:abc123:12345' | ||
| } | ||
| ---- | ||
|
|
||
| You can also verify the result in the Neo4j Browser by running the following query: | ||
|
|
||
| [source, cypher] | ||
| ---- | ||
| MATCH (m:Movie {title: "Matrix, The"})<-[a:ACTED_IN]-(p:Person) | ||
| RETURN m, a, p | ||
| ---- | ||
|
|
||
| You should see your `Person` node connected to _The Matrix_ movie. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. Tell the learner what the expect outcome should be. |
||
|
|
||
|
|
||
| include::questions/verify.adoc[leveloffset=+1] | ||
|
|
||
|
|
||
| == Troubleshooting | ||
|
|
||
| .ts-node: command not found | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Troubleshooting - good idea for complex activities. Used as a last resort, we should design the course content so that these scenarios are few, and prepare the learner to be able to solve their own issues. Im not sure about giving multiple options for fixing an issue: . use ts-node It prompts questions for the learner:
I would direct them back to the installation instructions in the course which should be comprehensive / robust enough to cover the majority of scenarios. |
||
| [%collapsible] | ||
| ==== | ||
| If you receive a `ts-node: command not found` error, you can either: | ||
|
|
||
| 1. Install `ts-node` globally: | ||
| + | ||
| [source,sh] | ||
| ---- | ||
| npm install -g ts-node | ||
| ---- | ||
|
|
||
| 2. Or run via npx: | ||
| + | ||
| [source,sh,subs=attributes+] | ||
| ---- | ||
| npx ts-node {lab-file} | ||
| ---- | ||
| ==== | ||
|
|
||
| .Cannot use import statement outside a module | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feels like a [TIP] if its something we expect to happen often. We cant control all environment issues on all learners computers though - this is why codespaces are such a positive. |
||
| [%collapsible] | ||
| ==== | ||
| This error occurs when Node.js tries to run TypeScript/ES modules as CommonJS. | ||
| Ensure your `tsconfig.json` has the correct module settings, or run with: | ||
|
|
||
| [source,sh,subs=attributes+] | ||
| ---- | ||
| npx ts-node --esm {lab-file} | ||
| ---- | ||
| ==== | ||
|
|
||
| .Verification fails but code works | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok. We could end up putting this on every lesson where the code uses the database though. I would prefer a test at the start to ensure everything is setup correctly before proceeding. |
||
| [%collapsible] | ||
| ==== | ||
| If your code runs successfully and creates the node (you can see it in Neo4j Browser) but the verification fails: | ||
|
|
||
| 1. Ensure you are using the sandbox provided by GraphAcademy (not a local database) | ||
| 2. Check that the Person node was created with an `ACTED_IN` relationship to the movie titled "Matrix, The" | ||
| 3. Try refreshing the page and clicking Verify again | ||
| ==== | ||
|
|
||
|
|
||
| [.summary] | ||
| == Lesson Summary | ||
|
|
||
| In this challenge, you used your knowledge to create a driver instance and run a Cypher statement. | ||
|
|
||
| Next, we will look at the Neo4j Type System and some of the considerations that you need to make when working with values coming from Neo4j in your TypeScript application. | ||
|
|
||
| // @last-fix 2025-12-02 | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Providing a view of what the user should see is a good addition.
It gives learners: