diff --git a/examples/simple/server/app.js b/examples/simple/server/app.js index 68ab0e7a..55ee8b32 100644 --- a/examples/simple/server/app.js +++ b/examples/simple/server/app.js @@ -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()); diff --git a/examples/simple/shared/fetchers/flickr.js b/examples/simple/server/fetchers/flickr.js similarity index 100% rename from examples/simple/shared/fetchers/flickr.js rename to examples/simple/server/fetchers/flickr.js diff --git a/examples/simple/shared/fetcherClass.js b/examples/simple/shared/fetcherClass.js index d28ec560..037a1575 100644 --- a/examples/simple/shared/fetcherClass.js +++ b/examples/simple/shared/fetcherClass.js @@ -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; diff --git a/examples/simple/webpack.config.js b/examples/simple/webpack.config.js index 2048111a..a1eb3eaf 100644 --- a/examples/simple/webpack.config.js +++ b/examples/simple/webpack.config.js @@ -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: { @@ -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')) ] };