Category: node

Bingo for meetings- Adding a CLI application–part 12

Bingo is a small project, written in TypeScript , and developed with Alexandru Badita in launch break (one hour - more or less). You can find sources at . Those are my blog posts for Bingo : ( scroll below for the post)
1Create meeting
2Create Tests
3Finalize Create meeting
4Sharing meeting
5Keep Score
6Add obsolete
7Finalizing obsolete
8End meeting
9Dockerize tests
10Azure CI tests
11Yarn workspaces
13Intermezzo - CLI improvements
14typescript compile run with node
15NestJS ,swagger and create a meeting
16Finalizing API
17Intermezzo - jest vs jasmine error
18Refactor WebAPI and test service
19Heroku Deploy NestJs
21Deploy Angular to GitHub

(Now the actual blog post for Bingo Meetings project)

The easy way to test an application is to make a simple command line version . You can find the code at

You can run also with Docker by running

What were the steps ?

1. Install the @types/node, ts-node , typescript and others – see

2. Create an index.ts with the required CLI ( hint: prompt, figlet, chalk , username , inquirer,console.table are good to have) – read

3. Created an async main() and calling with

(async () => {
  try {
      await main();
        } catch (e) {


4. Modify package.json  to have

“main”: “dist/index.js”,

“types”: “dist/index.d.ts”,

“scripts”: {

“start”: “ts-node index.ts”,

“build”: “tsc”,

“compile”: “tsc”


5. Put in the root package

“scripts”: {

“test”: “cd bingo-meeting-objects-test && yarn test”,

“runConsole”: “cd bingo-meeting-console && yarn start”


and then run yarn runConsole

I can say that the C# console experience is better 😉

You can download the source code from

Obtain data from ANAF(local IRS)

In ROmania ANAF is providing a WebAPI that allows access to some of the information that any enterprise should provide. The API is described at ,

I have made a C# console and a node,js script.

The differences: is easiear in node to make an http request.

2. For C# – I think in components. For node – I think in application.

Without further ado, here is the code

using RestSharp;
using System;

namespace InfoAnafWS
    class Program
        static void Main(string[] args)
            if(args.Length == 0)
                Console.WriteLine("lipseste CUI ");
            var client = new RestClient("");
            var request = new RestRequest("PlatitorTvaRest/api/v3/ws/tva", Method.POST);
            request.RequestFormat = DataFormat.Json;
            string date = DateTime.Now.AddDays(-5).ToString("yyyy-MM-dd");
            string req = "";
            foreach (var item in args)
                req += string.Format(@"{{'cui': {1}, 'data':'{0}'}}", date, item);
            req = req.Replace("'", "\"");
            req = "[" + req + "]";

            request.AddParameter("application/json", req, ParameterType.RequestBody);
            var data = client.Execute(request);

const start = async () => {
let request = require('request');

const d = require('delay');
await d(1000);
var fs = require('fs');
var array = fs.readFileSync('CUI.txt').toString().split("\r\n");
var start=0;

	var nr = Math.floor(Math.random() * Math.floor(495))+1;
	var jsonData=[];
	console.log('start at ' + start+  ' for nr ' + nr);
	var i=0;
	while(i<nr && i+start<array.length){
		jsonData.push({"cui": array[i+start], "data":"2018-03-26"});
	var finish=false;
	console.log('array :'+ jsonData[0].cui + '-'  + jsonData[nr-1].cui);
    { json: jsonData },
    function (error, response, body) {
        if (!error && response.statusCode == 200) {
			fs.writeFile(`text${start}_${nr}.json`, JSON.stringify( body ), function (err) {
            if (err) {
                return console.log(err);

            console.log("The file was saved!" + `text${start}_${nr}.json`);

	start = start+nr;
		await d(13000);



Andrei Ignat weekly software news(mostly .NET)

* indicates required

Please select all the ways you would like to hear from me:

You can unsubscribe at any time by clicking the link in the footer of our emails. For information about our privacy practices, please visit our website.

We use Mailchimp as our marketing platform. By clicking below to subscribe, you acknowledge that your information will be transferred to Mailchimp for processing. Learn more about Mailchimp's privacy practices here.