How does one debug NextJS React apps with WebStorm?

The following steps work for me: start the app with next (npm run dev or whatever your start script looks like) add breakpoints, create JavaScript Debug run configuration, specify http://localhost:3000 URL debug If you like to debug the code that is executed on the server side, I’d suggest using the Node.js run configuration with node_modules\next\dist\bin\next … Read more

How to get folder path using electron

As @phuongle pointed out in the comments you want to use showOpenDialog(). Something like this: var remote = require(‘remote’); var dialog = remote.require(‘electron’).dialog; var path = dialog.showOpenDialog({ properties: [‘openDirectory’] }); UPDATE: If the above isn’t working for your current Electron version, you should try more modern importing: const {dialog} = require(‘electron’).remote; In addition, in order … Read more

Joi validator conditional schema

I achieved the same in a little different manner. Posting the same here since this might be useful for someone in future. const schema = Joi.object({ type: Joi.number().required().valid(1, 2, 3), firstname: Joi.alternatives().conditional(‘type’, { is: 1, then: Joi.string().required() }), lastname: Joi.alternatives().conditional(‘type’, { is: 1, then: Joi.string().required() }), salary: Joi.alternatives().conditional(‘type’, { is: 2, then: Joi.number().required() }), pension: … Read more

MongoDB on with Docker “failed to connect to server [localhost:27017] on first connect “

By default Compose sets up a single network for your app. Each container for a service joins the default network and is both reachable by other containers on that network, and discoverable by them at a hostname identical to the container name. According to your docker-compose.yaml file you can access you mongo container on 127.0.0.1:27017 … Read more

understanding the concept of javascript callbacks with node.js, especially in loops

If the callback is defined in the same scope the loop is defined in (which is frequently the case), then the callback will have access to the index variable. Leaving aside NodeJS particulars for a moment, let’s consider this function: function doSomething(callback) { callback(); } That function accepts a callback function reference and all it … Read more

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