NodeJs how to display table structured in console

You can use console.table() API without installing any node module. NodeJS Added in: v10.0.0, Browser compatibility

const structDatas = [
    { handler: 'http', endpoint: 'http://localhost:3000/path', method: 'ALL' },
    { handler: 'event', endpoint: 'http://localhost:3000/event', method: 'POST' },
    { handler: 'GCS', endpoint: 'http://localhost:3000/GCS', method: 'POST' }
];
console.table(structDatas);

The stdout in terminal like this:

enter image description here

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)