Organize routes in Node.js

I found a short example in ´Smashing Node.js: JavaScript Everywhere´ that I really liked. By defining module-a and module-b as its own express applications, you can mount them into the main application as you like by using connects app.use( ) : module-a.js module.exports = function(){ var express = require(‘express’); var app = express(); app.get(‘/:id’, function(req, … Read more

Flask url_for generating http URL instead of https

With Flask 0.10, there will be a much better solution available than wrapping url_for. If you look at https://github.com/mitsuhiko/flask/commit/b5069d07a24a3c3a54fb056aa6f4076a0e7088c7, a _scheme parameter has been added. Which means you can do the following: url_for(‘secure_thingy’, _external=True, _scheme=”https”, viewarg1=1, …) _scheme sets the URL scheme, generating a URL like https://.. instead of http://. However, by default Flask only … Read more

AngularJS dynamic routing

angular.module(‘myapp’, [‘myapp.filters’, ‘myapp.services’, ‘myapp.directives’]). config([‘$routeProvider’, function($routeProvider) { $routeProvider.when(‘/page/:name*’, { templateUrl: function(urlattr){ return ‘/pages/’ + urlattr.name + ‘.html’; }, controller: ‘CMSController’ }); } ]); Adding * let you work with multiple levels of directories dynamically. Example: /page/cars/selling/list will be catch on this provider From the docs (1.3.0): “If templateUrl is a function, it will be called … Read more

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