Open ~/.bash_profile
in your favorite editor and add the following content to the bottom.
# Git branch in prompt.
parse_git_branch() {
const low = require('lowdb') | |
const jsonServer = require('json-server') | |
const config = require('./startup_config.json'); | |
let app; | |
let bodyParser; | |
config.addMiddleware = function(bp, express, q) { | |
bodyParser = bp; | |
app = express; |
By: @BTroncone
Also check out my lesson @ngrx/store in 10 minutes on egghead.io!
Update: Non-middleware examples have been updated to ngrx/store v2. More coming soon!
Table of Contents
function healthcheck(args, finished) { | |
finished({ | |
ok: true, | |
timestamp: Date.now() | |
}); | |
} | |
module.exports = { | |
restModule: true, |
const express = require('express') | |
const app = express(); | |
const router1 = express.Router(); | |
router1.route('/test1').get(function(req, res) { | |
res.json('test1'); | |
}); | |
const router2 = express.Router(); | |
router2.route('/test2').get(function(req, res) { |
var RequestHandler = function () { | |
this.checkConnection = function () {}; | |
this.getQueryResult = function (sQuery) { | |
this.checkConnection(); | |
try { | |
return this.conn.executeQuery.apply(this.conn, arguments); | |
} catch (err) { | |
this.conn.close(); |
var fs = require('fs'); | |
function Account(file) { | |
this._file = file; | |
} | |
Account.prototype.readfile = function () { | |
if (!this._file) { | |
throw new Error('File not found') | |
} |
function Account(statement, transaction){ | |
this._statement = statement | |
this._transaction = transaction | |
this._balance = 0; | |
} | |
Account.prototype.deposit = function(amount) { | |
this._transaction.deposit(amount) | |
this._statement.storeHistory(amount, this._balance, "Deposit") | |
} |
# Start the old vagrant | |
$ vagrant init centos-6.3 | |
$ vagrant up | |
# You should see a message like: | |
# [default] The guest additions on this VM do not match the install version of | |
# VirtualBox! This may cause things such as forwarded ports, shared | |
# folders, and more to not work properly. If any of those things fail on | |
# this machine, please update the guest additions and repackage the | |
# box. |