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
var express = require('express'); | |
var app = express(); | |
app.get('/', function (req, res) { | |
res.send('Hello World'); | |
}); | |
app.listen(3000); |
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
// calculator.js | |
export function sum(a, b) { | |
return a + b; | |
}; | |
// app.js | |
import calculator from "calculator"; | |
console.log(calculator.sum(1, 2)); |
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
// calculator.js | |
(function (root, factory) { | |
if (typeof exports === 'object') { | |
// CommonJS | |
module.exports = factory(); | |
} else if (typeof define === 'function' && define.amd) { | |
// AMD | |
define([], function () { | |
return (root.returnExportsGlobal = factory()); | |
}); |
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
// calculator.js | |
System.register("calculator", [], function (_export) { | |
"use strict"; | |
var __moduleName = "calculator"; | |
function sum(a, b) { | |
return a + b; | |
} | |
return { |
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 from 'react'; | |
import { match, RoutingContext } from 'react-router'; | |
import ReactDOMServer from 'react-dom/server'; | |
import Express from 'express'; | |
import http from 'http'; | |
import Routes from './src/routes'; | |
let app = Express(); | |
let port = process.env.PORT || DefaultConfig.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
{ | |
"version": "0.0.1", | |
"private": true, | |
"name": "oceny-frontend", | |
"dependencies": { | |
"axios": "0.7.0", | |
"ejs": "2.3.4", | |
"express": "4.13.3", | |
"history": "1.12.3", | |
"nodemon": "1.8.0", |
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 from 'react'; | |
import { match, RoutingContext } from 'react-router'; | |
import ReactDOMServer from 'react-dom/server'; | |
import Express from 'express'; | |
import http from 'http'; | |
import Routes from './src/routes'; | |
import Webpack from 'webpack'; | |
import WebpackMiddleware from 'webpack-dev-middleware'; | |
import DefaultConfig from './webpack/default.config.js'; | |
import DevConfig from './webpack/development.config.js'; |
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
let app = Express(); |
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
"scripts": { | |
"start": "nodemon --exec babel-node -- server.js", | |
"build": "rimraf dist && NODE_ENV=production webpack --config ./webpack/production.config.js --progress --profile --colors", | |
"production": "NODE_ENV=production npm start" | |
} |
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
// ejs templates configuration | |
app.engine('ejs', require('ejs').__express); | |
app.set('view engine', 'ejs'); | |
// static files served from dir configured in DefaultConfig.Dir | |
app.use(Express.static(DefaultConfig.Dist)); | |
// in development use WebpackMiddleware to make js/css bundle | |
if (isDevelopment) { | |
const compiler = Webpack(DevConfig); |