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
# docker-compose.yml | |
version: '2' | |
services: | |
postgresql: | |
image: postgres | |
environment: | |
- POSTGRES_USER=railsapi | |
- POSTGRES_DB=railsapi_production | |
- POSTGRES_PASSWORD | |
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
# docker-compose.yml | |
webapi: | |
build: . | |
restart: always | |
ports: | |
- 80:3000 | |
links: | |
- postgresql | |
environment: | |
- POSTGRES_PASSWORD |
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
# Dockerfile | |
FROM node:6 | |
# Create app directory | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# Install app dependencies | |
COPY package.json /usr/src/app/ | |
RUN npm install |
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
// test/server.test.js | |
const exec = require('mz/child_process').exec; | |
const request = require('supertest-as-promised'); | |
const expect = require('chai').expect; | |
const app = require('../server/app'); | |
describe('builds application', function () { | |
it('builds to "build" directory', function () { | |
// Disable mocha time-out because this takes a lot of time |
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
// server/app.js | |
const express = require('express'); | |
const morgan = require('morgan'); | |
const path = require('path'); | |
const app = express(); | |
// Setup logger | |
app.use(morgan(':remote-addr - :remote-user [:date[clf]] ":method :url HTTP/:http-version" :status :res[content-length] :response-time ms')); |
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
// src/index.js | |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { browserHistory } from 'react-router'; | |
import Routes from './routes'; | |
import './index.css'; | |
ReactDOM.render( |
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
// src/components/App/index.js | |
import React, { PropTypes, Component } from 'react'; | |
import classnames from 'classnames'; | |
import logo from './logo.svg'; | |
import './style.css'; | |
class App extends Component { | |
// static propTypes = {} | |
// static defaultProps = {} |
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
// src/components/NotFound/index.js | |
import React, { PropTypes, Component } from 'react'; | |
import classnames from 'classnames'; | |
import './style.css'; | |
export default class NotFound extends Component { | |
// static propTypes = {} | |
// static defaultProps = {} | |
// state = {} |
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
// src/components/About/index.js | |
import React, { PropTypes, Component } from 'react'; | |
import classnames from 'classnames'; | |
import './style.css'; | |
export default class About extends Component { | |
// static propTypes = {} | |
// static defaultProps = {} | |
// state = {} |
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
// src/routes.js | |
import React from 'react'; | |
import { Router, Route } from 'react-router'; | |
import App from './components/App'; | |
import About from './components/About'; | |
import NotFound from './components/NotFound'; | |
const Routes = (props) => ( | |
<Router {...props}> |