Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Create Your Own Node Module

cd node_modules
mkdir myCoolModule
cd myCoolModule
touch index.js
npm init
(answer yes to all)
exports.? all functions and variables you want to be used in other places.
/*for react*/

import {?1, ?2} from 'myCoolModule'
/*for expressJS*/

const myCoolModule = require('myCoolModule');
myCoolModule.?1
myCoolModule.?2
 
PREVIOUS NEXT
Tagged: #Create #Your #Own #Node #Module
ADD COMMENT
Topic
Name
5+6 =