From ca9813b59cea57f5df8faf0ac4bbe29c702b3286 Mon Sep 17 00:00:00 2001 From: jean Date: Sat, 29 Jun 2024 07:49:00 +0200 Subject: [PATCH 1/3] docs: Emphasizing the monolythic approach in generated plugin README --- templates/app-esm/routes/README.md | 9 ++++++--- templates/app-ts-esm/src/routes/README.md | 12 +++++++++--- templates/app-ts/src/app.ts | 1 - templates/app-ts/src/routes/README.md | 12 +++++++++--- templates/app/routes/README.md | 11 +++++++---- 5 files changed, 31 insertions(+), 14 deletions(-) diff --git a/templates/app-esm/routes/README.md b/templates/app-esm/routes/README.md index fd8d0b2a..0d4c6812 100644 --- a/templates/app-esm/routes/README.md +++ b/templates/app-esm/routes/README.md @@ -1,8 +1,11 @@ # Routes Folder -Routes define routes within your application. Fastify provides an -easy path to a microservice architecture, in the future you might want -to independently deploy some of those. +Routes define the pathways within your application. +Fastify's structure supports the modular monolith approach, where your +application is organized into distinct, self-contained modules. +This facilitates easier scaling and future transition to a microservice architecture. +Each module can evolve independently, and in the future, you might want to deploy +some of these modules separately. In this folder you should define all the routes that define the endpoints of your web application. diff --git a/templates/app-ts-esm/src/routes/README.md b/templates/app-ts-esm/src/routes/README.md index 9d209026..0d4c6812 100644 --- a/templates/app-ts-esm/src/routes/README.md +++ b/templates/app-ts-esm/src/routes/README.md @@ -1,8 +1,11 @@ # Routes Folder -Routes define endpoints within your application. Fastify provides an -easy path to a microservice architecture, in the future you might want -to independently deploy some of those. +Routes define the pathways within your application. +Fastify's structure supports the modular monolith approach, where your +application is organized into distinct, self-contained modules. +This facilitates easier scaling and future transition to a microservice architecture. +Each module can evolve independently, and in the future, you might want to deploy +some of these modules separately. In this folder you should define all the routes that define the endpoints of your web application. @@ -22,3 +25,6 @@ and eventually extract them. If you need to share functionality between routes, place that functionality into the `plugins` folder, and share it via [decorators](https://fastify.dev/docs/latest/Reference/Decorators/). + +If you're a bit confused about using `async/await` to write routes, you would +better take a look at [Promise resolution](https://fastify.dev/docs/latest/Reference/Routes/#promise-resolution) for more details. diff --git a/templates/app-ts/src/app.ts b/templates/app-ts/src/app.ts index 58aabb66..be51f922 100644 --- a/templates/app-ts/src/app.ts +++ b/templates/app-ts/src/app.ts @@ -31,7 +31,6 @@ const app: FastifyPluginAsync = async ( dir: join(__dirname, 'routes'), options: opts }) - }; export default app; diff --git a/templates/app-ts/src/routes/README.md b/templates/app-ts/src/routes/README.md index 9d209026..0d4c6812 100644 --- a/templates/app-ts/src/routes/README.md +++ b/templates/app-ts/src/routes/README.md @@ -1,8 +1,11 @@ # Routes Folder -Routes define endpoints within your application. Fastify provides an -easy path to a microservice architecture, in the future you might want -to independently deploy some of those. +Routes define the pathways within your application. +Fastify's structure supports the modular monolith approach, where your +application is organized into distinct, self-contained modules. +This facilitates easier scaling and future transition to a microservice architecture. +Each module can evolve independently, and in the future, you might want to deploy +some of these modules separately. In this folder you should define all the routes that define the endpoints of your web application. @@ -22,3 +25,6 @@ and eventually extract them. If you need to share functionality between routes, place that functionality into the `plugins` folder, and share it via [decorators](https://fastify.dev/docs/latest/Reference/Decorators/). + +If you're a bit confused about using `async/await` to write routes, you would +better take a look at [Promise resolution](https://fastify.dev/docs/latest/Reference/Routes/#promise-resolution) for more details. diff --git a/templates/app/routes/README.md b/templates/app/routes/README.md index 3fe1becf..0d4c6812 100644 --- a/templates/app/routes/README.md +++ b/templates/app/routes/README.md @@ -1,8 +1,11 @@ # Routes Folder -Routes define routes within your application. Fastify provides an -easy path to a microservice architecture, in the future you might want -to independently deploy some of those. +Routes define the pathways within your application. +Fastify's structure supports the modular monolith approach, where your +application is organized into distinct, self-contained modules. +This facilitates easier scaling and future transition to a microservice architecture. +Each module can evolve independently, and in the future, you might want to deploy +some of these modules separately. In this folder you should define all the routes that define the endpoints of your web application. @@ -13,7 +16,7 @@ typically stored in a file; be careful to group your routes logically, e.g. all `/users` routes in a `users.js` file. We have added a `root.js` file for you with a '/' root added. -If a single file becomes too large, create a folder and add a `index.js` file there: +If a single file become too large, create a folder and add a `index.js` file there: this file must be a Fastify plugin, and it will be loaded automatically by the application. You can now add as many files as you want inside that folder. In this way you can create complex routes within a single monolith, From 7a961f0f06ac3514ed30b3f87ff7863cc87b805c Mon Sep 17 00:00:00 2001 From: jean Date: Sat, 29 Jun 2024 07:55:16 +0200 Subject: [PATCH 2/3] fix: typo --- templates/app-esm/routes/README.md | 2 +- templates/app-ts-esm/src/routes/README.md | 2 +- templates/app-ts/src/routes/README.md | 2 +- templates/app/routes/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/app-esm/routes/README.md b/templates/app-esm/routes/README.md index 0d4c6812..83f144ab 100644 --- a/templates/app-esm/routes/README.md +++ b/templates/app-esm/routes/README.md @@ -16,7 +16,7 @@ typically stored in a file; be careful to group your routes logically, e.g. all `/users` routes in a `users.js` file. We have added a `root.js` file for you with a '/' root added. -If a single file become too large, create a folder and add a `index.js` file there: +If a single file becomes too large, create a folder and add a `index.js` file there: this file must be a Fastify plugin, and it will be loaded automatically by the application. You can now add as many files as you want inside that folder. In this way you can create complex routes within a single monolith, diff --git a/templates/app-ts-esm/src/routes/README.md b/templates/app-ts-esm/src/routes/README.md index 0d4c6812..83f144ab 100644 --- a/templates/app-ts-esm/src/routes/README.md +++ b/templates/app-ts-esm/src/routes/README.md @@ -16,7 +16,7 @@ typically stored in a file; be careful to group your routes logically, e.g. all `/users` routes in a `users.js` file. We have added a `root.js` file for you with a '/' root added. -If a single file become too large, create a folder and add a `index.js` file there: +If a single file becomes too large, create a folder and add a `index.js` file there: this file must be a Fastify plugin, and it will be loaded automatically by the application. You can now add as many files as you want inside that folder. In this way you can create complex routes within a single monolith, diff --git a/templates/app-ts/src/routes/README.md b/templates/app-ts/src/routes/README.md index 0d4c6812..83f144ab 100644 --- a/templates/app-ts/src/routes/README.md +++ b/templates/app-ts/src/routes/README.md @@ -16,7 +16,7 @@ typically stored in a file; be careful to group your routes logically, e.g. all `/users` routes in a `users.js` file. We have added a `root.js` file for you with a '/' root added. -If a single file become too large, create a folder and add a `index.js` file there: +If a single file becomes too large, create a folder and add a `index.js` file there: this file must be a Fastify plugin, and it will be loaded automatically by the application. You can now add as many files as you want inside that folder. In this way you can create complex routes within a single monolith, diff --git a/templates/app/routes/README.md b/templates/app/routes/README.md index 0d4c6812..83f144ab 100644 --- a/templates/app/routes/README.md +++ b/templates/app/routes/README.md @@ -16,7 +16,7 @@ typically stored in a file; be careful to group your routes logically, e.g. all `/users` routes in a `users.js` file. We have added a `root.js` file for you with a '/' root added. -If a single file become too large, create a folder and add a `index.js` file there: +If a single file becomes too large, create a folder and add a `index.js` file there: this file must be a Fastify plugin, and it will be loaded automatically by the application. You can now add as many files as you want inside that folder. In this way you can create complex routes within a single monolith, From f4c477f2b3ca8ecd55261ffe8387b979b0a0d5d8 Mon Sep 17 00:00:00 2001 From: jean Date: Sat, 29 Jun 2024 08:01:37 +0200 Subject: [PATCH 3/3] docs: avoid redundancy --- templates/app-esm/routes/README.md | 3 +-- templates/app-ts-esm/src/routes/README.md | 3 +-- templates/app-ts/src/routes/README.md | 4 ++-- templates/app/routes/README.md | 3 +-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/templates/app-esm/routes/README.md b/templates/app-esm/routes/README.md index 83f144ab..75b5658c 100644 --- a/templates/app-esm/routes/README.md +++ b/templates/app-esm/routes/README.md @@ -4,8 +4,7 @@ Routes define the pathways within your application. Fastify's structure supports the modular monolith approach, where your application is organized into distinct, self-contained modules. This facilitates easier scaling and future transition to a microservice architecture. -Each module can evolve independently, and in the future, you might want to deploy -some of these modules separately. +In the future you might want to independently deploy some of those. In this folder you should define all the routes that define the endpoints of your web application. diff --git a/templates/app-ts-esm/src/routes/README.md b/templates/app-ts-esm/src/routes/README.md index 83f144ab..75b5658c 100644 --- a/templates/app-ts-esm/src/routes/README.md +++ b/templates/app-ts-esm/src/routes/README.md @@ -4,8 +4,7 @@ Routes define the pathways within your application. Fastify's structure supports the modular monolith approach, where your application is organized into distinct, self-contained modules. This facilitates easier scaling and future transition to a microservice architecture. -Each module can evolve independently, and in the future, you might want to deploy -some of these modules separately. +In the future you might want to independently deploy some of those. In this folder you should define all the routes that define the endpoints of your web application. diff --git a/templates/app-ts/src/routes/README.md b/templates/app-ts/src/routes/README.md index 83f144ab..084748f8 100644 --- a/templates/app-ts/src/routes/README.md +++ b/templates/app-ts/src/routes/README.md @@ -4,8 +4,8 @@ Routes define the pathways within your application. Fastify's structure supports the modular monolith approach, where your application is organized into distinct, self-contained modules. This facilitates easier scaling and future transition to a microservice architecture. -Each module can evolve independently, and in the future, you might want to deploy -some of these modules separately. +In the future you might want +to independently deploy some of those. In this folder you should define all the routes that define the endpoints of your web application. diff --git a/templates/app/routes/README.md b/templates/app/routes/README.md index 83f144ab..75b5658c 100644 --- a/templates/app/routes/README.md +++ b/templates/app/routes/README.md @@ -4,8 +4,7 @@ Routes define the pathways within your application. Fastify's structure supports the modular monolith approach, where your application is organized into distinct, self-contained modules. This facilitates easier scaling and future transition to a microservice architecture. -Each module can evolve independently, and in the future, you might want to deploy -some of these modules separately. +In the future you might want to independently deploy some of those. In this folder you should define all the routes that define the endpoints of your web application.