Skip to content

Commit

Permalink
example: flickr fetcher should only be added on serverside, fix webpa…
Browse files Browse the repository at this point in the history
…ck config
  • Loading branch information
Rajiv Tirumalareddy committed Aug 20, 2014
1 parent bd5cc88 commit 6146609
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 3 additions & 0 deletions examples/simple/server/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ var http = require('http'),
express = require('express'),
Fetcher = require('../shared/fetcherClass'),
readFlickr = require('../shared/getFlickrPhotos'),
flickrFetcher = require('./fetchers/flickr'),
readFlickrServer,
templatePath = path.join(__dirname, '..', 'shared', 'index.html');

Fetcher.addFetcher(flickrFetcher);

var app = express();

app.use(Fetcher.middleware());
Expand Down
File renamed without changes.
7 changes: 2 additions & 5 deletions examples/simple/shared/fetcherClass.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var fetchr = require('../../../index'),
var fetchr = require('../../../libs/fetcher.js'),
Fetcher = fetchr({
pathPrefix: '/myapi'
}),
flickrFetcher = require('./fetchers/flickr');

Fetcher.addFetcher(flickrFetcher);
});

module.exports = Fetcher;
5 changes: 3 additions & 2 deletions examples/simple/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
* Copyright 2014, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var webpack = require('webpack');
var webpack = require('webpack'),
path = require('path');
module.exports = {
entry: require.resolve('./client/app.js'),
output: {
Expand All @@ -11,6 +12,6 @@ module.exports = {
},
plugins: [
//Replace fetcher lib with client side fetcher lib
new webpack.NormalModuleReplacementPlugin(/^..\/..\/..\/index.js$/, require.resolve('fetchr/libs/fetcher.client.js'))
new webpack.NormalModuleReplacementPlugin(/^..\/..\/..\/libs\/fetcher.js$/, path.resolve('../../libs/fetcher.client.js'))
]
};

0 comments on commit 6146609

Please sign in to comment.