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

Docs: esm syntax #3253

Merged
merged 3 commits into from Aug 16, 2021
Merged

Docs: esm syntax #3253

merged 3 commits into from Aug 16, 2021

Conversation

zekth
Copy link
Member

@zekth zekth commented Aug 12, 2021

Adding ESM syntax to examples, as its the modern way to write JS these days.
This covers the main readme and the getting started example. Not sure if the whole documentation needs a patch

Checklist

@zekth zekth added the documentation Improvements or additions to documentation label Aug 12, 2021
@@ -21,6 +21,13 @@ yarn add fastify
Let's write our first server:
```js
// Require the framework and instantiate it

// ESM
Copy link
Member

Choose a reason for hiding this comment

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

Just to share, would it be more straightforward for users get a table

esm cjs
code code

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Won't this break the doc website? I will be hard to read on all devices

Copy link
Member

Choose a reason for hiding this comment

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

Just for curiosity, how the website would looks like with:

ESM
import Fastify from 'fastify'
const fastify = Fastify({
  logger: true
})
Commonjs
const fastify = require('fastify')({
  logger: true
})

?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@RafaelGSS RafaelGSS left a comment

Choose a reason for hiding this comment

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

LGTM.

@mcollina mcollina merged commit aee28e8 into fastify:main Aug 16, 2021
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants