My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

How to print the value by console.log or any other log in npm package?

Shubham Batra's photo
Shubham Batra
·Feb 18, 2017

I am trying to edit moment package . So I have just add console.log but that does not print any value.

This is my first time when i edited any npm package.

Basically I want to do some changes on npm package moment but I have no idea, Is changes code is working or not ?

So I make server server.js

import express from 'express';
import moment from 'moment';


const app = express();

app.get('/', (req, res) => {

  const time = moment().format('DD/MMM/YYYY');
  var input = "2014-01-08 8:00 AM";
  var offset = 300;
  var m = moment.utc(input, "YYYY-MM-DD h:mm A").add(offset, 'minutes').utcOffset(offset);
  let data;
  try {

    data = moment.parseZone("2015-01-01 00:00:00", "YYYY-MM-DD HH:mm:ss", "fr", true, "05:00");
  } catch (e) {
    console.log(e);
  }
  res.send({msg: time, m: m.format(), data});

});

app.listen(4000);
console.log('app is runing on 4000 port ');

after running server I did not get any message print on my terminal .

Is I am missing something ? there is other way to change in package and test ?