-
Você não precisa gerenciar CORS na API. Para o ambiente de desenvolvimento você pode utilizar o React Proxy: https://facebook.github.io/create-react-app/docs/proxying-api-requests-in-development
-
Ao utilizar o proxy informado acima, você vai poder remover
http://localhost:3001
do seu código. -
Não precisa adicionar o termo
fetch
nas suas sagas. Ou seja, ao invés defetchAddBuilding
ecallFetchAddBuilding
, bastaaddBuilding
ecallAddBuilding
. -
store.dispatch(loadBuildingsList());
não deveria estar noindex.js
(eu sei que no meu artigo está assim, mas aquilo é só um exemplo básico). Não são todas as páginas que vão precisar carregar a lista de buildings. Por exemplo, se o usuário for diretamente parahttp://localhost:3000/new-item
, não tem porque disparar uma requisição para carregar a listagem de buildings. -
Inclusive, o fato de esse
store.dispatch(loadBuildingsList());
estar no index faz com que ele seja chamado apenas uma vez. Se eu acesso o sistema, vou para a página de adi
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
const { MongoMemoryServer } = require('mongodb-memory-server'); | |
async function connect() { | |
const mongoConnection = new MongoMemoryServer({ debug: true }); | |
const status = mongoConnection.getInstanceInfo(); | |
console.log(status); | |
const connectionString = await mongoConnection.getConnectionString(); | |
console.log('================================================================================='); |
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
const { MongoMemoryServer } = require('mongodb-memory-server'); | |
async function connect() { | |
const mongoConnection = new MongoMemoryServer({ debug: true }); | |
const status = mongoConnection.getInstanceInfo(); | |
console.log(status); | |
const connectionString = await mongoConnection.getConnectionString(); | |
console.log('================================================================================='); |
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
[ | |
{ "_id": 123, "title": "Buy pizza" }, | |
{ "_id": 456, "title": "Watch Netflix" } | |
] |
To create your Kubernetes cluster on AWS (Amazon Web Services), first, you will have to create a new account on this service (you can also use one that you might have available). Then, you will have to follow these instructions to install the AWS Command-Line Interface (CLI). Make sure you follow the instructions for your operating system.
After creating your account and installing the CLI tool, you will have to create an Amazon EKS Service Role and create an Amazon EKS Cluster VPC. To accomplish that, you can go through the steps shown in this AWS documentation.
Now, still on the Getting Started with Amazon EKS page, search for the section that teaches you "to install `aw
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
# coding=utf-8 | |
# 1 - imports | |
from datetime import date | |
from actor import Actor | |
from base import Session, engine, Base | |
from movie import Movie | |
# 2 - generate database schema |
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
const client = new ApolloClient({ | |
uri: "http://localhost:4000/graphql", | |
request: operation => { | |
operation.setContext(context => ({ | |
headers: { | |
...context.headers, | |
authorization: "Bearer " + auth.getIdToken(), | |
}, | |
})); | |
}, |
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
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: nginx-cluster-ip | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 80 | |
selector: |
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
handleAuthentication() { | |
return new Promise((resolve, reject) => { | |
this.auth0.parseHash((err, authResult) => { | |
if (err) return reject(err); | |
if (!authResult || !authResult.idToken) { | |
return reject(err); | |
} | |
this.idToken = authResult.idToken; | |
this.profile = authResult.idTokenPayload; | |
// set the time that the id token will expire at |
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 bodyParser = require('body-parser'); | |
const jwt = require('express-jwt'); | |
const jwksRsa = require('jwks-rsa'); | |
var app = express(); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ extended: false })); | |
const jwtCheck = jwt({ |
NewerOlder