https://nodejs.org/
> npm install <package-name>
> npm install jquery
example:
require('package-name')
var foo = require('package-name');
var $ = require('jquery');
// then you can use $ as jQuery function
example: demo.js
Ooops!! jquery got some problem in Node.js
> npm install lodash
var _ = require('lodash');
var myArray = ['spring','summer','winter'];
_.each(myArray, function(s) {
console.log(s);
});
2. create demo.js file, and require package.
1. in cmd : npm package lodash
> node demo
3. in cmd : run demo.js
> npm install lodash
var _ = require('lodash');
var myArray = ['spring','summer','winter'];
_.each(myArray, function(s) {
console.log(s);
});
2. create demo.js file, and require package.
1. in cmd : npm package lodash
> node demo
3. in cmd : run demo.js
> npm install lodash
var _ = require('lodash');
var myArray = ['spring','summer','winter'];
_.each(myArray, function(s) {
console.log(s);
});
2. create demo.js file, and require package.
1. in cmd : npm package lodash
> node demo
3. in cmd : run demo.js
> npm install lodash
var _ = require('lodash');
var myArray = ['spring','summer','winter'];
_.each(myArray, function(s) {
console.log(s);
});
2. create demo.js file, and require package.
1. in cmd : npm package lodash
> node demo
3. in cmd : run demo.js
var express = require('express');
var app = express();
app.listen(3000);
> npm install express
app.js
> node app
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
app.listen(3000);
app.js
var express = require('express');
var app = express();
var data = {
'001':{'name':'Jayson','ext':'#7540'},
'002':{'name':'Test','ext':'#9999'}
};
app.get('/api', function (req, res) {
res.json(data);
});
app.listen(3000);
app.js
var express = require('express');
var app = express();
var data = {
'001':{'name':'Jayson','ext':'#7540'},
'002':{'name':'Test','ext':'#9999'}
};
app.get('/api/:id', function (req, res) {
var id = req.params.id;
res.json(data[id]);
});
app.listen(3000);
app.js
> npm install gulp-gm
> npm install --global gulp
> npm install gulp
var gulp = require('gulp');
var gm = require('gulp-gm');
gulp.task('default', function() {
gulp.src("src/**/*.{jpg,png,bmp}")
.pipe(gm(function(gmfile) {
return gmfile.resize(260, 260);
}))
.pipe(gulp.dest("dist/img"));
});
gulpfile.js
> gulp
https://www.openshift.com/
> node filename.js
> node
> node filename
quit: [Ctrl + C * 2]
command mode:
execute program:
Visual Studio 2015
Visual Studio Code
Sublime Text 2/3
free ~ $5999
free
free / $70
50MB
9GB
20MB
> npm init
> npm install <PackageName>
> npm uninstall <PackageName>
install:
uninstall:
make package-file:
NuGet , NPM , Bower (1)
NuGet
NPM
Bower
.NET package
Node.js package
front-end package
> Install-Package <package-name>
> npm install <package-name>
> bower install <package-name>
bower.json
NuGet
NPM
Bower
packages.config
package.json
bower.json
/Scripts
/Styles
/...
/node_modules
/bower_components
NuGet , NPM , Bower (2)
var bar = require("./file-name.js");
var foo = require("package-name");
var bar = require("./file-name");
import files:
import package:
find local package first, then global package.
must have "./" for file.
( and install Node.js ASAP...)