Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Web Api vs Node.js

I have quite recently started to connect a web platform that I work on to other quite complex systems mostly written in C#. Most of my experience is in web development in PHP and JavaScript And I also have some experience in writing web services in WCF.

Sadly I had experienced many difficulties in writing WCF services for my PHP web platform, slow development, very (very) complicated configurations in-order to respond well in JSON and to work RESTful and more.

Naturally I started looking around at other technologies, one in particular caught my eye Node.js which might be perfect for me because I have quite a lot of experience in JavaScript and that way I won't need my windows server anymore. My other option is of course to keep writing services in C# but switch to ASP.NET Web API instead. The switch will probably be much easier than from WCF to Node.js.

Any thoughts or suggestions in the matter? Does anyone have experience in writing web services in Node.js and can point me in the direction of a good tutorial? or am I way off and I shouldn't be using Node.js for web services at all?

like image 469
Itay Weiss Avatar asked Mar 17 '14 16:03

Itay Weiss


People also ask

Which is better ASP.NET or NodeJS?

ASP.NET is preferred by developers and enterprises for larger applications, whereas Node. js. is more suitable for fast, lightweight software and mobile applications.

Is NodeJS best for API?

js is lightweight, fast and scalable. Node. js allows you to build fast, scalable API Proxy capable of handling a huge number of simultaneous requests with high throughput.

Is .NET similar to NodeJS?

Similar to Node. js, . NET helps developers build and deploy web-based, mobile server or desktop workloads.

Is C# better than node JS?

When it comes to speed, NodeJS was once revolutionary and much faster than an ASP.NET Web Forms or MVC.NET application running . NET with C#. However, as best stated in the benchmarks and explanations mentioned below from Stack Overflow, C# / . NET Core has made vast improvements in speed and is now faster than NodeJS.


1 Answers

I have just recently started working on express.js. Let me tell you it's not for the fainthearted. The whole mentality of "If you are already familiar with JS then that's half the battle." really couldn't be further from the truth. I.E. if you are a hardcore devops guy like me.

I have a unified build process for all my asp.net application build, test and coverage reporting, deployment, configuration management and code quality analysis all setup and automated. It takes me literally 5 min to setup a Build process around a new project and have it tested, analysed, staged and shipped off to a production environment. (And really so should all the devs in the world. But hey, who am I kidding.) Then there's the monitoring, logging, performance analysis and profiling. Again all well unified, orchestrated and centrally managed.

I'm not saying node.js/express.js doesn't have those, but you have to develope/learn a COMPLETELY NEW set of services and platform just to run node.js.

Hammering out a bunch of code is one thing. Running a production system on a foreign technology is something else altogether.

Unless you looking for trouble ahem i mean, challenge :D, stick to WebAPI. WebDeploy is a god send.

BTW. Use BasicHttpBinding with your WCF endpoint and get PHP to generate the client class from the WSDL. Yes. Soap is your answer, not an "easier to use rest". Something like https://code.google.com/p/php-wsdl-creator/. Archiving the WSDL from the WCF endpoint also allows you to track with pin point accuracy of your service signature and format changes. It ensures type safety, and handles ser/de for you. I don't care much about how ugly the message looks if I don't have to deal with it. And yes I have done it before with PHP and python. Works flawlessly.

like image 88
Sleeper Smith Avatar answered Sep 23 '22 17:09

Sleeper Smith