You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/pages/intermediate/nest-vs-controller-api.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
**Nest.js** builds on top of Express (or optionally Fastify) and introduces a **structured, modular architecture** with features like **decorator-based routing, dependency injection (DI), and controllers**, making it more comparable to **.NET Controller APIs** than plain Express.js. By enforcing a convention-driven approach similar to ASP.NET Core, Nest.js simplifies the development of scalable applications while integrating well with TypeScript’s strong typing. Its use of decorators for defining routes and DI for managing services closely resembles the approach used in .NET, making it feel more structured and maintainable than raw Express.
4
4
5
-
However, **Nest.js does not match .NET in performance**. Since Nest.js runs on Node.js, it inherits the limitations of JavaScript’s single-threaded event loop, leading to potential bottlenecks in CPU-bound workloads. While Fastify can improve Nest’s performance over Express, it still cannot compete with **.NET’s high-performance Kestrel server**, which is optimized for multi-threading and asynchronous processing. That said, **Nest.js is more production-ready than Express**, as it includes built-in support for **authentication, validation, middleware, and structured DI**, reducing the need for third-party dependencies.
5
+
Since Nest.js runs on Node.js, it inherits the limitations of JavaScript’s single-threaded event loop, leading to potential bottlenecks in CPU-bound workloads. While Fastify can improve Nest’s performance over Express, it still comes up short against **.NET’s high-performance Kestrel server**, which is optimized for multi-threading and asynchronous processing. That said, Nest.js is more production-ready than Express, as it includes built-in support for **authentication, validation, middleware, and structured DI**, reducing the need for third-party dependencies and more "batteries included".
6
6
7
7
::: tip If you're already using Nest.js
8
8
If your team is already using Nest.js, chances are that there is a need for the more structured approach of Nest.js over Express.js. In this case, you will find that .NET controller web APIs are conceptually similar, but probably overall easier to work with because of the type system (e.g. parameter type checking is automatic, OpenAPI schema bindings are "free")
Copy file name to clipboardExpand all lines: docs/pages/intro-and-motivation.md
+5-1Lines changed: 5 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,16 @@ Over the years, .NET and C# have evolved heavily (as has Microsoft) and now ***"
6
6
7
7
During that time, the language design of both C# and TypeScript (JavaScript as well) have *converged* more than other languages. The two languages are now remarkably similar in their core syntax such that developers that know one can typically pick up the other fairly easily.
8
8
9
-
This guide aims to provide a walkthrough of just how similar these two languages are, but also highlight where C# and .NET can solve some of the pain points that many teams using TypeScript *on the backend* will no doubt encounter.
9
+
This guide aims to provide a walkthrough of just how similar these two languages are and in fact can be used bi-directionally. In many cases, it will highlight where C# and .NET can solve some of the pain points that many teams using TypeScript *on the backend* will no doubt encounter.
10
10
11
11
::: tip Don't forget to check the repo!
12
12
Many of the code examples in this guide are actually in [the GitHub repo](https://github.com/CharlieDigital/typescript-is-like-csharp). Be sure to check it out so you can see the full examples and play around with the code yourself.
13
13
:::
14
14
15
+
::: info
16
+
This guide was inspired by the [Kotlin is Like C#](https://ttu.github.io/kotlin-is-like-csharp/) guide I came across while learning Kotlin.
17
+
:::
18
+
15
19
## Are They *Really* Similar?
16
20
17
21
Before you ready your pitchforks, check out some of the similarities between TypeScript and C#:
0 commit comments