Starting a personal node project could be easy; starting a team node project could be challenging.
I am a developer currently working in SEEK Australia.
In my experience, common mistakes developer make when starting a projects are:
- No Linting
Starting a personal node project could be easy; starting a team node project could be challenging.
I am a developer currently working in SEEK Australia.
In my experience, common mistakes developer make when starting a projects are:
This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.
which git
create different ssh key according the article Mac Set-Up Git
$ ssh-keygen -t rsa -C "[email protected]"
Name | MIMEType | Extension | Description | |
---|---|---|---|---|
aac | audio/aac | .aac | AAC audio file | |
abw | application/x-abiword | .abw | AbiWord document | |
arc | application/octet-stream | .arc | Archive document (multiple files embedded) | |
avi | video/x-msvideo | .avi | AVI: Audio Video Interleave | |
azw | application/vnd.amazon.ebook | .azw | Amazon Kindle eBook format | |
bin | application/octet-stream | .bin | Any kind of binary data | |
bz | application/x-bzip | .bz | BZip archive | |
bz2 | application/x-bzip2 | .bz2 | BZip2 archive | |
csh | application/x-csh | .csh | C-Shell script |
import { Platform, ActionSheetIOS } from 'react-native'; | |
import DocumentPicker from 'react-native-document-picker'; | |
import ImagePicker from 'react-native-image-picker'; | |
import RNFS from 'react-native-fs'; | |
type Captions = { | |
image: string, | |
document: string, | |
cancel: string, | |
title: string, |
var db = mongoose.connect('mongodb://localhost:27017/DB'); | |
// In middleware | |
app.use(function (req, res, next) { | |
// action after response | |
var afterResponse = function() { | |
logger.info({req: req}, "End request"); | |
// any other clean ups |
// Async/Await requirements: Latest Chrome/FF browser or Babel: https://babeljs.io/docs/plugins/transform-async-to-generator/ | |
// Fetch requirements: Latest Chrome/FF browser or Github fetch polyfill: https://github.com/github/fetch | |
// async function | |
async function fetchAsync () { | |
// await response of fetch call | |
let response = await fetch('https://api.github.com'); | |
// only proceed once promise is resolved | |
let data = await response.json(); | |
// only proceed once second promise is resolved |
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
// 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 "./permission"; // middleware for checking if user's role is permitted to make request | |
const app = express(), | |
api = express.Router(); | |
// first middleware will setup db connection |
/** | |
* Simple authentication and authorization example with passport, node_acl, | |
* MongoDB and expressjs | |
* | |
* The example shown here uses local userdata and sessions to remember a | |
* logged in user. Roles are persistent all the way and applied to user | |
* after logging in. | |
* | |
* Usage: | |
* 1. Start this as server |