Last active
August 7, 2016 20:47
-
-
Save yanivkalfa/b50a433a7f5128eb6e49326ac3e6ce5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import path from 'path'; | |
import express from 'express'; | |
import noCache from 'connect-cache-control'; | |
import log from 'server/log'; | |
import settings from 'server/settings'; | |
import mainRoute from './routes/main'; | |
const app = express(); | |
var someFn = function someFnEmut() { | |
return function(req, res, next) { | |
console.log('ggggggggggggggggggggggggggggggggggggggggg'); | |
console.log(req.url); | |
console.log('__dirname', __dirname); | |
next(); | |
}; | |
}; | |
app.use(someFn()); | |
app.use(log.requestLogger()); | |
app.get('/log.gif/:message', noCache, log.route()); | |
const buildDir = '/build/server'; | |
const staticDir = path.join(settings.APP_HOME, buildDir); | |
app.use('/static', express.static('/')); | |
app.use('/', mainRoute); | |
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import settings from 'server/settings'; | |
import app from 'server/app.js'; | |
const host = process.env.APP_HOST || settings.APP_HOST; | |
const port = process.env.APP_PORT || settings.APP_PORT; | |
app.listen(port, (err) => { | |
if (err) { | |
console.log(err); | |
return; | |
} | |
console.log(`Listening at http://${ host }:${ port }`); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component, PropTypes } from 'react'; | |
import { Link, IndexLink } from 'react-router'; | |
import styles from "./someCompWithStyle.css"; | |
export default class SomeCompWithStyle extends Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( | |
<div className={styles.justDiv}>Nothing</div> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; // eslint-disable-line strict | |
var path = require('path'); | |
var webpack = require('webpack'); | |
var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
var nodeExternals = require('webpack-node-externals'); | |
var fs = require('fs'); | |
module.exports = { | |
devtool: 'sourcemap', | |
resolve: { | |
root: path.join(__dirname, 'source') | |
}, | |
entry: [ | |
'./source/server/server.js' | |
], | |
output: { | |
path: path.join(__dirname, 'build/server'), | |
filename: 'index.js', | |
publicPath: '/', // path.join(__dirname, '/static') | |
}, | |
target: 'node', | |
externals: nodeExternals(), | |
plugins: [ | |
new ExtractTextPlugin("styles.css") | |
], | |
module: { | |
loaders: [ | |
{ | |
test: /\.jsx?$/, | |
exclude: /node_modules/, | |
loaders: ['babel'] | |
}, | |
{ | |
test: /\.js$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/, | |
query: { | |
plugins: ['transform-runtime'], | |
presets: ['es2015', 'stage-0', 'react'], | |
} | |
}, | |
{ | |
test: /\.json?$/, | |
loader: 'json', | |
}, | |
{ | |
test: /\.css?$/, | |
//loader: 'css/locals?module&localIdentName=[name]__[local]___[hash:base64:5]' | |
/* | |
loader: ExtractTextPlugin.extract({ | |
fallbackLoader: "style-loader", | |
loader: 'css/locals?sourceMap&module' | |
})*/ | |
loader: ExtractTextPlugin.extract('style', 'css?module&localIdentName=[name]__[local]___[hash:base64:5]'), | |
}, | |
{ | |
test: /\.(jpe?g|png|gif|svg|eot|ttf|woff[0-9]*?)$/, | |
loader: 'url', | |
query: {limit: 10240} | |
} | |
] | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment