Issue
After stumbling upon the typscript-node starter released by microsoft, i started to get lost.
Can we really replace node with typescript on the server? There are several serverside things that TS does well: - Creating a web API service with express - Managing the CRUD queries with mongoDB
And much more... I am used to generate an api with node and connect angular to that api. Am i wrong? Should we switch to TS on the backend and forget about writing node code on the server?
Solution
Typescript is a (or rather, a superset of) language - not a runtime. It is the equivalent of Javascript except it needs to be compiled to run on the Node.js runtime.
You can write the backend with Typescript if you want, and then run it through ts-node, or just compile down to ES6 via tsc and then run it with standard Node (v8+ is recommended). This is what I do with many projects. It is still "node code", it just has all the benefits (and gimmicks) or Typescript.
Answered By - Michael Fedora
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.