Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| var cluster = require('cluster'); | |
| if (cluster.isWorker) { | |
| console.log('Worker ' + process.pid + ' has started.'); | |
| // Send message to master process. | |
| process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'}) | |
| // Receive messages from the master process. |
Related Setup: https://gist.github.com/hofmannsven/6814278
Related Pro Tips: https://ochronus.com/git-tips-from-the-trenches/
| // Docs/etc. | |
| server.get(null, '/', function(request, response, next) { | |
| response.send(302, null, { | |
| Location: config.siteName + '/docs' | |
| }); | |
| return next(); | |
| }, log.w3c); | |
| server.get(null, '/docs', function(req, res, next) { |
| // require modules | |
| var restify = require('restify'), | |
| i18n = require('i18n'), | |
| app; | |
| // minimal config | |
| i18n.configure({ | |
| locales: ['en', 'de'], | |
| directory: __dirname + '/locales' | |
| }); |
| import {call, put, take, fork} from 'redux-saga/effects' | |
| import {END} from 'redux-saga' | |
| import CategoryActions, {CategoryTypes} from '../Redux/CategoryRedux' | |
| // attempts to fetch category | |
| export function* fetchCategoryServer (api) { | |
| let action = yield take(CategoryTypes.CATEGORY_SERVER) | |
| // check when it stopped | |
| while (action !== END) { | |
| yield fork(fetchCategoryAPI, api) |
using mocha/chai/sinon for node.js unit-tests? check out my utility: mocha-stirrer to easily reuse test components and mock require dependencies
| /* | |
| * Node.js Sample Server with Restify | |
| * Copyright (C) 2014 - Thiago Uriel M. Garcia | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * |