Skip to content
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

Add links to JavaScript SDK reference #1041

Merged
merged 1 commit into from
Nov 14, 2023

Conversation

itowlson
Copy link
Contributor

(also contains a couple of unrelated typo fixes because the spell checker was yelling at me)

Content must go through a pre-merge checklist.

Pre-Merge Content Checklist

This documentation has been checked to ensure that:

  • The title, template, and date` are all set
  • Does this PR have a new menu item (anywhere in templates/*.hbs files) that points to a document .md that is set to publish in the future? If so please only publish the .md and .hbs changes in real-time (otherwise there will be a menu item pointing to a .md file that does not exist)
  • File does not use CRLF, but uses plain LF (hint: use cat -ve <filename> | grep '^M' | wc -l and expect 0 as a result)
  • Has passed bart check
  • Has been manually tested by running in Spin/Bartholomew (hint: use PREVIEW_MODE=1 and run npm run styles to update styling)
  • Headings are using Title Case
  • Code blocks have the programming language set to properly highlight syntax and the proper copy directive
  • Have tested with npm run test and resolved all errors
  • Relates to an existing (potentially outdated) blog article? If so please add URL in blog to point to this content.

Copy link
Contributor

@karthik2804 karthik2804 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one tiny spelling not related to this PR but otherwise looks great!

In JavaScript or TypeScript, the handler is identified by name. It must be called `handleRequest`. The way you declare it is slightly different between the two languages.

In **JavaScript**, `handleRequest` is declared as `export async function`. It takes a JsvaScript object representing the request, and returns a response object. The fields of these objects are exactly the same as in TypeScript:
In **JavaScript**, `handleRequest` is declared as `export async function`. It takes a JsvaScript [object representing the request](https://fermyon.github.io/spin-js-sdk/interfaces/HttpRequest.html), and returns a [response object](https://fermyon.github.io/spin-js-sdk/interfaces/HttpResponse.html). The fields of these objects are exactly the same as in TypeScript:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In **JavaScript**, `handleRequest` is declared as `export async function`. It takes a JsvaScript [object representing the request](https://fermyon.github.io/spin-js-sdk/interfaces/HttpRequest.html), and returns a [response object](https://fermyon.github.io/spin-js-sdk/interfaces/HttpResponse.html). The fields of these objects are exactly the same as in TypeScript:
In **JavaScript**, `handleRequest` is declared as `export async function`. It takes a JavaScript [object representing the request](https://fermyon.github.io/spin-js-sdk/interfaces/HttpRequest.html), and returns a [response object](https://fermyon.github.io/spin-js-sdk/interfaces/HttpResponse.html). The fields of these objects are exactly the same as in TypeScript:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice spot! Thanks!

Signed-off-by: itowlson <ivan.towlson@fermyon.com>
@itowlson itowlson merged commit 5e684dc into fermyon:main Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants