Skip to main content

What is Command Design Pattern and how to implement it?

Intent - Encapsulate a request as an object thereby letting you parameterize with different requests , queue or log requests and support undoable options

Now we will create two classes exit command will exit out of nodejs and create command will create new file.

Now the interesting part of this post comes where we will define a class with help of which we will be able to run above defined commands , undo previously run command or redo previously undo command.

At last with help of readline module we will take input from user of command which is to be executed..

Hope you like the post.Keep learning...


Comments

Popular posts from this blog

Making axios request using redux thunk react

How to integrate redux thunk with react? First run below command to get redux thunk installed Now add the redux thunk configuration to index.js file of your project Below is the sample folder structure to be followed.. Firstly lets code actions related to creating video on route /video/create Now at last lets make reducer function to handle actions dispatched Hope you like the post...