This is a simple example of a module that exports a function. The function is where all your giving to the community lies. Make sure when you write your first module for npm, it is more significant than the one stated in the example.
Follow the prompts to sign in to npm (if you aren't already signed in) This will publish your module to npm and return a link that you can use to access the module from the npm website.
Now that we have published our module, let’s install it in a project. Let’s create a new directory for our project. Post that create a package.json file for our project. We will use the npm init command to create a package.json file for our project. We will also use the --yes option to skip the prompts that npm init offers us. This will create a basic package.json file for you to use.
Let’s now create an index.js file for our project. Did you do everything right? Did you get what you expected? Maybe/Maybe not. Let's unearth more secrets in coming episodes.

Writing a npm module

  • 4.
    This is asimple example of a module that exports a function. The function is where all your giving to the community lies. Make sure when you write your first module for npm, it is more significant than the one stated in the example.
  • 6.
    Follow the prompts tosign in to npm (if you aren't already signed in) This will publish your module to npm and return a link that you can use to access the module from the npm website.
  • 7.
    Now that wehave published our module, let’s install it in a project. Let’s create a new directory for our project. Post that create a package.json file for our project. We will use the npm init command to create a package.json file for our project. We will also use the --yes option to skip the prompts that npm init offers us. This will create a basic package.json file for you to use.
  • 9.
    Let’s now createan index.js file for our project. Did you do everything right? Did you get what you expected? Maybe/Maybe not. Let's unearth more secrets in coming episodes.