$ docker
apt-get update && apt-get install -y python3 python3-pip git | |
git clone -b dev https://github.com/symbol/symbol.git | |
cd symbol/sdk/python | |
./scripts/ci/setup_build.sh | |
python3 -m pip install -r requirements.txt | |
# generate catbuffer models and test vectors | |
./scripts/ci/build.sh |
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works | |
const axios = require('axios'); // promised based requests - like fetch() | |
function getCoffee() { | |
return new Promise(resolve => { | |
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee | |
}); | |
} |
import * as mongoose from 'mongoose'; | |
export let Schema = mongoose.Schema; | |
export let ObjectId = mongoose.Schema.Types.ObjectId; | |
export let Mixed = mongoose.Schema.Types.Mixed; | |
export interface IHeroModel extends mongoose.Document { | |
name: string; | |
power: string; |
// the main app file | |
import express from "express"; | |
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db) | |
import authenticate from "./authentication"; // middleware for doing authentication | |
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
If you don't have homebrew installed - get homebrew here
Then run: brew install elasticsearch
Update the elasticsearch configuration file in /usr/local/etc/elasticsearch/elasticsearch.yml
.
###Prerequesites
- Install node.js from http://nodejs.org
- Make sure you install git from http://git-scm.com
Install flightplan globally
npm install -g flightplan
Install flightplan in your project folder
Deploying a node app with Forever is great...until your server restarts unexpectedly. Then your app stops running and you have to re-deploy.
To get around this, we're going to run our node app as an Upstart service. Upstart services are great, because, once started, the system auto-restarts them if they fail, or if the server restarts.
###Step 1: Create a service for your node app
- ssh in as root
ssh root@youripaddress
- Create a node-app.conf file in /etc/init
IMPORTANT: whatever filename you pick is what you will use to start|stop|restart your service i.e.service node-app start
##Setup your server (this would ideally be done with automated provisioning)
- add a deploy user with password-less ssh see this gist
- install forever
npm install -g forever
##Install flightplan
npm install -g flightplan
- in your project folder
npm install flightplan --save-dev
- create a flightplan.js file