ducky/web

Paddy 2015-06-30 Parent:99a43a6d1d30

13:d51e39bf909c Go to Latest

ducky/web/bin/dev-server

Update our profiles collection to use ampersand-rest-collection. Use ampersand-rest-collection instead of ampersand-collection, so we can take advantage of the excellent "getOrFetch" function to fall back on the server when looking for a member of the collection that isn't downloaded yet. Also, use the correct Authorization header when making profile collection requests. Finally, if the profile collection requests fail due to an expired access token, use the refresh token to acquire a new access token, then retry the request.

History
1 #!/usr/bin/env node
3 var fs = require('fs')
4 var path = require('path')
5 var webpack = require('webpack')
6 var WebpackDevServer = require('webpack-dev-server')
7 var argv = require('minimist')(process.argv.slice(2))
8 var findRoot = require('find-root')
9 var rootFolder = findRoot(process.env.PWD)
11 var configfile = '';
13 // get config
14 if (argv.config) {
15 configfile = path.resolve(argv.config)
16 } else {
17 configfile = path.resolve(path.join(rootFolder, 'webpack.config.js'))
18 }
19 argv.config = require(configfile);
21 // run it
22 new WebpackDevServer(webpack(argv.config), {
23 historyApiFallback: true,
24 hot: true,
25 publicPath: argv.config.output.publicPath,
26 }).listen(argv.config.port, argv.config.host, function (err, result) {
27 if (err) {
28 console.log(err)
29 }
30 console.log('development server running at: http://' + argv.config.host + ':' + argv.config.port)
31 })