Monday 10 April 2017

What is process.env.UNIVERSAL in this node.js code

I'm working through a react with node tutorial and i have some code that looks like this:

if(process.env.UNIVERSAL){

  markup = ReactDOMServer.renderToString(...)

  .
  .
  .
}

I understand that process.env stores environment variables but i'm not sure what UNIVERSAL is or where it comes from. I tried to print it out in this code:

const port = process.env.PORT || 3000;
const env = process.env.NODE_ENV || 'production';
server.listen(port, err => {
 if (err) {
  return console.error(err);
 }
console.info(process.env.UNIVERSAL + ' test');
console.info(`Server running on http://localhost:${port} [${env}]`);
});

But it comes out undefined. Any idea what process.env.UNIVERSAL is?



via rage

No comments:

Post a Comment