기본 콘텐츠로 건너뛰기

What is require and module?

Module means :

"Each of a set of standardized parts or independent units that can be used to construct a more complex structure, such as an item of furniture or a building"

from google dictionary.

I can easily find which words should be replaced with programming terms and get a rough idea what it is in Node js. I assume all of you will as well.


What is require?
source :
https://steemit.com/utopian-io/@sagorahmed/node-js-basic-tutorial

Once a module is created, it could be exported and used by require func.
Or we simply require it from installed packages. like express or http.
well I handily installed express trying mern tutorial now but haven't required http nor installed it yet.
I will see soon enough tho.


-How to create a module

export.myDateTime = function(){
return Date()
}

-How to include

dt = require('./myfirstmodule')

I could have used naver blog which is way more neat and fancy with provided decoration tools for postings and blog environment.
But here its got all the struggles uploaded that I had posted so far, I won't probably moving to Naver anyways,
 but im telling you, this is the RAWEST posting page that I have ever experienced in my life provided by grand portal site.

Or maybe there is a way that I can use it more conveniently and fancy
but I just don't know how AND I don't really care.

We all can see here that I was not born to be a CSS expert nor web designer. not my thing.

...it is handy to go back to p tagged paragraph after I paste a line of code from editor.

댓글

이 블로그의 인기 게시물

JS 5.5 task6 Create an extendable calculator

<HTML>   <body>   </body>   <script> function Calculator() {   let methods = {     "-" : (a, b) => a - b,     "+" : (a, b) => a + b   };   //methods is an object which keeps key for operators   //and value to return the actual operation values   //each returns the result of operation that key(operator) does   this.calculate = function (str){     //calculate is one element in the function Calculator     //it takes the string and returns the value     //in the function element list is delimeted by , not ;     let split = str.split(" "),     a = +split[0],     op = split[1],     b = split [2]     if(!methods[op] || isNaN(a) || isNaN(b)) {       return NaN; // error handling     }     return methods[op](a,b);   }   this.addMethod = function(name, func){     methods[name] = func;     //this is how to add new key and ele to object   } } let powerCalc = new Calculator; powerCalc.addMethod("*&

JS 5.7 task5 Store read dates

<HTML>   <body>   </body>    <script>    let messages = [        {text: "Hello", from: "John"},        {text: "How goes?", from: "John"},        {text: "See you soon", from: "Alice"}    ];    let readMap = new WeakMap();    alert(readMap.size);    readMap.set(messages[0], new Date(2019, 3, 5));   </script> </HTML> <!-- task4 needed weakSet to save simply readmessage, this task needs to save THE TIME IT WAS READ along with the message itself the message out of the set or map means it hasn't been read I kinda feel good and bad at the same time to happen to read the solution but I do get to think more about the difference with tasks and be more available to understand the main contents so I think, its good? -->

How to set base url when deployed in Heroku? : base url and axios

https://stackoverflow.com/questions/47164330/axios-api-calls-in-heroku/47165888 baseUrl = process.env.baseURL || "http://localhost:5000" Even more stable way https://stackoverflow.com/questions/52129849/how-to-get-the-base-url-variable-on-a-deployed-heroku-node-app const production  = 'https://examplePage.com'; const development = 'http://localhost:3000/'; const url = (process.env.NODE_ENV ? production : development); process.env.NODE_ENV will resolve to undefined if you are running on localhost production mode. and return production if you have deployed the app production mode.