SCSS file watcher in WebStorm
After installing node-sass :
WebStorm Arguments
$FileName$ $FileNameWithoutExtension$.css
Keywords
SASS , SCSS
References
https://www.npmjs.com/package/node-sass
After installing node-sass :
WebStorm Arguments
$FileName$ $FileNameWithoutExtension$.css
Keywords
SASS , SCSS
References
https://www.npmjs.com/package/node-sass
global.jQuery = require("jquery")
or
window.$ = window.jQuery = require('jquery');
References
http://stackoverflow.com/questions/25334974/order-dependencies-jquery-is-not-defined-with-browserify
I usually set layout to false globally, so I know exactly what layout I use where (so no default layout):
app.set('view options', { layout: false });
Then in my routes I can set a layout per route like so:
res.render('my_page', { layout: 'my_layout' });
Keywords
expressjs , express.js , expressjs , nodejs , node.js
References
http://stackoverflow.com/questions/8790891/layouts-in-expressjs
Javascript | Libraries
JSHint
Nodejs and NPM Settings
References
http://stackoverflow.com/questions/28643618/require-keyword-not-being-recognized-by-webstorm
app.use(express.static('public'));
References
https://expressjs.com/en/starter/static-files.html
GET
// grab the packages we need var express = require('express'); var app = express(); var port = process.env.PORT || 8080; // routes will go here // start the server app.listen(port); console.log('Server started! At http://localhost:' + port);
http://example.com/api/users?id=4&token=sdfa3&geo=us
// routes will go here app.get('/api/users', function(req, res) { var user_id = req.param('id'); var token = req.param('token'); var geo = req.param('geo'); res.send(user_id + ' ' + token + ' ' + geo); });
POST
npm install body-parser --save
var bodyParser = require('body-parser'); app.use(bodyParser.json()); // support json encoded bodies app.use(bodyParser.urlencoded({ extended: true })); // support encoded bodies // POST http://localhost:8080/api/users // parameters sent with app.post('/api/users', function(req, res) { var user_id = req.body.id; var token = req.body.token; var geo = req.body.geo; res.send(user_id + ' ' + token + ' ' + geo); });
References
https://scotch.io/tutorials/use-expressjs-to-get-url-and-post-parameters
http://www.tutorialspoint.com/nodejs/nodejs_express_framework.htm
https://www.npmjs.com/package/body-parser-json
Verbose flag
npm install -g bower --verbose
Clean cache
npm cache clean
References
https://docs.npmjs.com/
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs
npm config set strict-ssl false npm config set registry "http://registry.npmjs.org/"
References :
http://stackoverflow.com/questions/7559648/is-there-a-way-to-make-npm-install-the-command-to-work-behind-proxy