Skip to content

Instantly share code, notes, and snippets.

View lopezjurip's full-sized avatar
🎯
Focusing

Patricio López Juri lopezjurip

🎯
Focusing
View GitHub Profile
# docker-compose.yml
version: '2'
services:
postgresql:
image: postgres
environment:
- POSTGRES_USER=railsapi
- POSTGRES_DB=railsapi_production
- POSTGRES_PASSWORD
# docker-compose.yml
webapi:
build: .
restart: always
ports:
- 80:3000
links:
- postgresql
environment:
- POSTGRES_PASSWORD
# 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
// 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
// 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'));
// 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(
// 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 = {}
// 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 = {}
// 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 = {}
@lopezjurip
lopezjurip / routes.js
Last active October 19, 2017 18:48
Using create-react-app with React Router + Express.js
// 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}>