Category: node.js

C# style object initialisation in TypeScript

@RoutingKey(‘abc’) class Foo { public name: string | undefined; public age: number | undefined; public gender: string | undefined; constructor(init?: Partial<Foo>) { if (init) { Object.assign(this, init); } } } const foo = new Foo({ name: ‘something’ }); Read more →

Microsoft’s Task Parallel Library and the principle behind node.js

I wanted to see how Microsoft’s Task Parallel Library compared with node.js in so far as passing the next method in to the current to chain the calls indefinitely. So I created a method that iteratively adds itself to the current executing Task. The initial test was to see if the code would fail with a StackOverflowException but what I… Read more →

node.js calling multiple web services in parallel var http = require(‘http’); // Add helloworld module var helloworld = require(‘helloworld_mod’); http.createServer(function(req, res) { res.writeHead(200, { ‘Content-Type’ : ‘text/xml’ }); try { // Bypass function call to “Google Maps API” getFromGoogle(req, res); } catch (e) { res.end(“Try again later”); } }).listen(1337, ‘’); console.log(‘Server running at’); console.log(‘Type the URL in address bar’); console.log(‘’ + ‘address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false’); function getFromGoogle(mainreq, mainres)… Read more →