Node – how to run app.js?

Assuming I have node and npm properly installed on the machine, I would Download the code Navigate to inside the project folder on terminal, where I would hopefully see a package.json file Do an npm install for installing all the project dependencies Do an npm install -g nodemon for installing all the project dependencies Then … Read more

Using HTML in Express instead of Jade

You can do it this way: Install ejs: npm install ejs Set your template engine in app.js as ejs // app.js app.engine(‘html’, require(‘ejs’).renderFile); app.set(‘view engine’, ‘html’); Now in your route file you can assign template variables // ./routes/index.js exports.index = function(req, res){ res.render(‘index’, { title: ‘ejs’ });}; Then you can create your html view in … Read more

What’s the use of Jade or Handlebars when writing AngularJs apps

I use Jade to generate templates consumed by AngularJS because I hate writing plain HTML. It looks something like: .control-group( ng-form name=”emailGroup” ng-class=”{“ng-error”: emailGroup.$invalid}” ) label.control-label Email .controls input( type=”email” ng-model=”user.email” required placeholder=”you@example.com” focus-on=’focusEmail’ ) … which I think is a lot cleaner than plain HTML.

Jade: Links inside a paragraph

As of jade 1.0 there’s an easier way to deal with this, unfortunately I can’t find it anywhere in the official documentation. You can add inline elements with the following syntax: #[a.someClass A Link!] So, an example without going into multiple lines in a p, would be something like: p: #[span this is the start … Read more

Change the “No file chosen”:

Hide the input with css, add a label and assign it to input button. label will be clickable and when clicked, it will fire up the file dialog. <input type=”file” id=”files” class=”hidden”/> <label for=”files”>Select file</label> Then style the label as a button if you want.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)