Tips:
- Read the introduction for each topic and dive deep only when needed
- Official documentation is, most of the time, the best source
Tips:
{ | |
"name": "Test", | |
"baseURL": "__baseURL__", | |
"otherBaseURL": "__baseURL__" | |
} |
componentDidUpdate(prevProps: Props) { | |
console.log('UPDATE'); | |
Object.keys(this.props) | |
.filter(key => this.props[key] !== prevProps[key]) | |
.map(key => { | |
console.log( | |
'changed property:', | |
key, | |
'from', | |
prevProps[key], |
const { graphqlExpress } = require('apollo-server-express'); | |
const { makeExecutableSchema } = require('graphql-tools'); | |
const { importSchema } = require('graphql-import'); | |
const resolvers = require('./graphql/resolvers'); | |
const setup = app => { | |
const schema = makeExecutableSchema({ | |
typeDefs: importSchema('src/graphql/schema.graphql'), | |
resolvers | |
}); |
scalar Date | |
type Query { | |
brokers(limit: Int): [Broker] | |
broker(id: ID!): Broker | |
investments(limit: Int): [Investment] | |
investment(id: ID!): Investment | |
} | |
type Broker { |
const { GraphQLString } = require('graphql'); | |
const { Broker, Investment, BalanceUpdate, Transaction } = require('../models'); | |
module.exports = { | |
Query: { | |
brokers: (obj, args) => Broker.all(args), | |
broker: (obj, { id }) => Broker.findById(id), | |
investments: (obj, args) => Investment.all(args), | |
investment: (obj, { id }) => Investment.findById(id) | |
}, |
scalar Date | |
type Query { | |
brokers(limit: Int): [Broker] | |
broker(id: ID!): Broker | |
investments(limit: Int): [Investment] | |
investment(id: ID!): Investment | |
} | |
type Broker { |
const expect = require('chai').expect; | |
const { Investment, Transaction } = require('../../src/models'); | |
describe('Transaction', () => { | |
describe('attributes', () => { | |
it('should have amount and date', async () => { | |
const transaction = await Transaction.create({ | |
amount: 1, | |
date: '2018-03-15' | |
}); |
const { Broker, Investment, Transaction, BalanceUpdate } = require('./models'); | |
const test = async () => { | |
// create broker | |
const broker = await Broker.create({ name: 'Fooinvest' }); | |
// create investment | |
const investment = await Investment.create({ | |
name: 'Tesouro Foo', | |
BrokerId: broker.get('id') | |
}); |
const ExtractTextPlugin = require("extract-text-webpack-plugin") | |
const path = require('path') | |
module.exports = { | |
entry: { | |
main: './src/index.js', | |
base: './src/css/base.css', | |
admin: './src/css/admin.css' | |
}, |