// The require() method is used to load and cache JavaScript modules.
// So, if you want to load a local, relative JavaScript module into a Node.js application,
// you can simply use the require() method.
// Example:
var yourModule = require( "your_module_name" ); //.js file extension is optional
/*In Express...*/
<script data-main = "javascripts/main" src = "https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.min.js"></script>
/*data-min is location of the requireJS code (e.g. define());*/
/*src is the requireJS code (you need this, requireJS does not work out of the box)*/
const foo = require('./foo.js')
//What happend when we require a module.
resolving and loading,wrapping,execution,returning exports and final caching.
3 types of module we can import.(core,developer and 3rd party module)
const http= require('http') //core module
const controller = require('./lib/controller') //developer module
const express = require('express') // 3rd party module
var require = function(src){
var fileAsStr = readFild(src)
var module.exports = {}
**const a = 10
exports.a = a;**
return module.exports
}