5 ms·
Yeah, unless I am building a very performance sensitive web service, either in terms of memory or CPU efficiency, js/typescript or some other web centric langua
by smolder 6y ago
Yeah, unless I am building a very performance sensitive web service, either in terms of memory or CPU efficiency, js/typescript or some other web centric language is a much easier choice, and is less costly to build in.
I'm still choosing to write some web stuff in Rust for the experience, for the fact I can compile parts to .wasm and re-use them in a browser too, I enjoy tuning things for performance, and I am not under time constraints for it.
- vector_spaces 6y agoWhat frameworks are recommended nowadays for Typescript? Is Express still dominant here or are there TS-first options?
- runarberg 6y agoIf you want static types you can still use typescript in JavaScript as doc comments. If you really want the syntax as well you can always compile your code down to javascript before. So express works just as well with typescript as it does with JavaScript
- Azeralthefallen 6y agonest.js is fantastic. https://nestjs.com/ https://nestjs.com/
- ducharmdev 6y agoAgreed - trying out nest.js the first time gave me hope that we'd see something like Django for typescript/javascript. Especially paired with nx workspaces, with shared code between front & backend... so nice.
- enumjorge 6y agoHow's their authentication solution? Auth is such a critical component of most web apps, yet something that IMO a lot of web frameworks don't fully flesh out compared to how easy it is with Django. I took a quick look at their auth docs, and while the docs seem pretty detailed, I noticed it involves multiple packages (@nestjs/passport, passport, passport-local, and their corresponding types) that you then have to glue together into a full solution. The instructions also apparently only show you how to store passwords in plain text, and using something like bcrypt to do it yourself is an exercise left to the reader. Not rocket science, as this [1] (older) article pointed out, it's hard finding quality auth-related tutorials in the Node ecosystem. With Django a lot of this stuff is built-in and solidly implemented. Granted, this was after a quick look at the docs, so my impression might be off. [0] https://docs.nestjs.com/security/authentication https://docs.nestjs.com/security/authentication [1] https://hackernoon.com/your-node-js-authentication-tutorial-is-wrong-f1a3bf831a46 https://hackernoon.com/your-node-js-authentication-tutorial-...
- nicoburns 6y agoWhat do you find you get from auth libraries? I've always found them much more trouble than they're worth. But I feel like I must be missing something.
- Blahah 6y agoPassportjs is the standard across all these frameworks. It's modular by design, so you can easily compose the right auth system for your needs. I've always found it quite intuitive and I've never seen anything even nearly as comprehensive in any language. http://www.passportjs.org/ http://www.passportjs.org/
- krono 6y agoEvery single typescript oriented library that I've tried has had a pretty atrocious dev experience and no end of compatibility issues. I love typescript, but the ecosystem is without a doubt one of the biggest detractors.
- girvo 6y agoNestJS is quite a bit better in that regard, but in general I agree with your overall point. What do you feel most of these frameworks are missing re. dev experience?
- krono 6y agoMostly use other languages for back-end systems, but I will definitely be checking out NestJS soon. With regards to TS, generally, it takes a lot of effort to get it to work. More often than not, getting to that point in a way that is actually useful/practical and cost effective, requires yet another library to be installed. Just look at the TSLint/ESLint migration problems, the popularity of all those TS runners such as ts-node/ts-node-dev/tsx-watch/ts-babel/etc., the complete lack of interoperability between all those separate pieces. Many issues and even proposed fixes to parts of the TS ecosystem - which is all community ran - are either ignored, left open because no one seems to be able to figure it out, or deemed to be out of scope. I don't know how to fix this honestly. Some leadership from Microsoft would be a good start.
- girvo 6y agoYeah that’s fair: I’m a bit of an early adopter of Deno [0] for that reason, it helps standardise quite a bit of that. Promising, anyway, if a bit rough currently. [0] https://deno.land https://deno.land
- Kaze404 6y agoYou don't need any of those. TSLint was deprecated long ago, and TS runners are only mildly useful in development (to the point where I don't bother and just `tsc && node dist`). Are you sure it's a problem with the ecosystem?
- foolofatom 6y agoI've been using https://tsed.io/ https://tsed.io/ with great success.
- zumu 6y agoI've been out of the JS/TS world for a couple years. Are decorators everywhere now? I will be very sad if so.
- mssundaram 6y agoMy experience is only n=3 but I've only rarely seen them where I've worked over the past 5 years. The only sane use case I've seen was for tagging logs and metrics.
- pas 6y agoTSed has a great dependency injection system, and uses decorators for a few things, I did not find its use excessive.
- girvo 6y agoI second the NestJS recommendation, but I’ve also got quite far using pretty stock standard Express style middleware with Deno. It’s been a fun experience.
- simplify 6y agoTwo I've been lightly following are Redwood[0] and Blitz[1]. Still a long ways behind something like Rails, but promising nonetheless. [0] https://github.com/blitz-js/blitz https://github.com/blitz-js/blitz [1] https://github.com/redwoodjs/redwood https://github.com/redwoodjs/redwood
- joshxyz 6y agoMy codes are written on JS but the sensitive parts are heavily commented with TS types so my vscode intellisense could assist me with correct types. /* * @type {Map<String, Number>} */ const map = new Map(); Like that. Express JS is still shit, koajs and fastify are a little better, I used to use nodejs's internal http and https libraries directly but these days uwebsockets.js is what you'd want since it's mature enough already (used by top crypto exchanges). https://github.com/uNetworking/uWebSockets.js/ https://github.com/uNetworking/uWebSockets.js/ And oh it comes with TS types which are cool.
- mleonhard 6y agoIs the JS/TS toolchain still a complicated undocumented mess? The last time I tried to use the JS/TS dev tools, I wasted many hours because the tools did zero validation of config files. All of the tools happily silently ignore misspelled config key names and invalid values. This makes simply debugging the tools a huge time sink.
- hda2 6y agoPardon my ignorance, but how are you using .wasm in the browser? How are getting values out of the web assembly module?
- jagged-chisel 6y agoJavaScript is used to fetch, initialize, and run the wasm module. As long as the module exports functions, they can be called from JS. There are JS libraries that will automatically setup up bindings for you.
- ctr_ctr 6y agohttps://rustwasm.github.io/wasm-bindgen/api/web_sys/ https://rustwasm.github.io/wasm-bindgen/api/web_sys/ Suit yourself
- smolder 6y agoI used wasm bindgen to make rust code callable from js. https://rustwasm.github.io/docs/wasm-bindgen/ https://rustwasm.github.io/docs/wasm-bindgen/
- pjmlp 6y agoI can do the same with Java and .NET based languages.
- smolder 6y agoWhich part? Compiling to .wasm? Java to me is "old reliable" but carries a lot of baggage and leaves a bad taste in my mouth to read/write. C#.NET I have less experience with. Neither can quite match Rust for cpu/memory efficiency, but they definitely have their place being capable, accessible, and efficient languages with robust "ecosystems".
- pjmlp 6y agoAll of them, native code, wasm, whatever. Yes, they might not match Rust down to the microsecond or byte count, it doesn't matter in distributed computing. There are bigger fishes to fry as distributed computing problems. And Rust type system for preventing data races among threads doesn't help when what is being used is distributed IPC across a cluster nodes.
- smolder 6y agoI understand where you're coming from. I hear the "bigger fish to fry" sentiment often. The point about distributed data races is a good one. At one point I did a comparison between a mono/Nancy web service and the same web service, feature for feature, built in NodeJS, Rust/rocket, and Go. I built a few different endpoints that did different types of work and load tested them, profiled memory usage, etc. I know mono and perhaps Nancy weren't the best point of comparison, and it's been some time since, but Rust/rocket really impressed me then, including on axes like ease of development and code readability. The perf deltas I saw could matter quite a bit at scale, allowing for fewer/cheaper servers. I've enjoyed using Rust for a few things since, personally, and am so far pretty unbothered by its shortcomings.
- rualca 6y ago> Yeah, unless I am building a very performance sensitive web service, either in terms of memory or CPU efficiency, js/typescript or some other web centric language is a much easier choice, and is less costly to build in. I really do not understand how convoluted javascript frameworks that require a thousand tools and checkers and dependencies just to put up a hello world are sold as "easier choices", specially when there is no mention of SPAs anywhere. Is it that hard to deliver static or dynamic HTML+CSS?