Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

☞ 

#Nodejs

  • for me i start at 20$/month is good start and then we can upgrade.Choose a datacenter region: DigitalOcean has many datacenters that mean you can pick one for your project if your visitors almost from NY United States let select New York, so example if i target all visitors from…
  • Your cloud vps is ready to use.Check your email address that you did register in DigitalOcean you shold get an email notify about your VPS IP, root account and password.
  • in this project we need open port 80 for http access, 443 https (ssl) , and port 22 (for ssh login) that is enough.By default Firewall is inactive, you can check it by run command sudo ufw statussudo ufw app listSo let config FW allow those ports bysudo ufw allow ‘Nginx…
  • So Node.js is requiredvisit to see the documentationWe use package management to install, here is command to install Node.js v9curl -sL | sudo -E bash -sudo apt-get install -y nodejsAfter successful Node.js installed we can check the version by typing in command line : node -v and you see see “v9.3.0″Setup…
  • we can change the port to 3001 or 3002, or 8080 … so if you pointed your domain tabvn.com to Degital Ocean cloud vps so this case we can visit the chat app in http://tabvn.com:3000 so we need just see nodejs web app in default port 80 such at http://tabvn.com , that…

I have been using DigitalOcean for me and setup for my customers, so recommend use it for your project just pick vps depend on how big of your project start at 5$ or 10$, 20$, price very flexibility…
Continue reading “Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting”

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting

☞ 

#Nodejs

  • for me i start at 20$/month is good start and then we can upgrade.Choose a datacenter region: DigitalOcean has many datacenters that mean you can pick one for your project if your visitors almost from NY United States let select New York, so example if i target all visitors from…
  • Your cloud vps is ready to use.Check your email address that you did register in DigitalOcean you shold get an email notify about your VPS IP, root account and password.
  • in this project we need open port 80 for http access, 443 https (ssl) , and port 22 (for ssh login) that is enough.By default Firewall is inactive, you can check it by run command sudo ufw statussudo ufw app listSo let config FW allow those ports bysudo ufw allow ‘Nginx…
  • So Node.js is requiredvisit to see the documentationWe use package management to install, here is command to install Node.js v9curl -sL | sudo -E bash -sudo apt-get install -y nodejsAfter successful Node.js installed we can check the version by typing in command line : node -v and you see see “v9.3.0″Setup…
  • we can change the port to 3001 or 3002, or 8080 … so if you pointed your domain tabvn.com to Degital Ocean cloud vps so this case we can visit the chat app in http://tabvn.com:3000 so we need just see nodejs web app in default port 80 such at http://tabvn.com , that…

I have been using DigitalOcean for me and setup for my customers, so recommend use it for your project just pick vps depend on how big of your project start at 5$ or 10$, 20$, price very flexibility…
Continue reading “Deploy React.js (create-react-app) Node.js to DigitalOcean Cloud Hosting”

React.js: The Hard Parts

State Management without #Redux:  by #ReactJS

  • If a user interacts with your application or refreshes the page, then we’ll look up state at that moment and rebuild the page.
  • In dynamic apps, like ones built using React, state change has to be dealt with immediately.
  • Managing state can get complicated if each component has some state.
  • Interaction with the components, like a mouse click, trigger these functions to update state.
  • For example to implement retweets: – – When the state is updated, the props will change too and render the child components again.

I am a full-stack software developer and passionate educator. I have been building for the web for almost two decades.
Continue reading “React.js: The Hard Parts”

Expo SDK 21.0.0 is now available – Exposition

  • We do recommend updating sooner rather than later — see this commit from our template projects for an example of how to update.When developing, using the new API lets us show an error screen if an error is hit during the first render of your app, instead of hanging or restarting:Note that…
  • This should make it significantly easier to tell the difference between an error loading your app and a slow network connection.If you are experiencing slow loading times when developing your app, check to see if you have the “tunnel” mode enabled in XDE/exp and try using LAN connections if your…
  • There is an example in the Native Component List, and Brent has also published a couple of example projects using the new API:We do have a documentation page for this API, although for the time being it just points to the GitHub repository.Google AdMobSDK 21 now supports displaying ads through…
  • To help your App Review process go more smoothly, we’ve decided to remove the Stripe SDK and experimental Payments API from apps built with the Expo standalone builder.
  • This was a problem with a dependency we used for detecting the machine IP address, and has been fixed.Upgrading Your AppHere’s how to upgrade your app to Expo SDK 21.0.0 from 20.0.0:Close XDE or your exp CLI serverIn app.json, change sdkVersion to “21.0.0”In package.json, change these dependencies:- react-native to expo to…

I am happy to announce the release of Expo SDK 21.0.0! It is based on React Native 0.48 “August”. Our previous SDK, 20.0.0, is based on React Native 0.47 “July”. AppLoading has been extended with new…
Continue reading “Expo SDK 21.0.0 is now available – Exposition”

Mocking API responses with React Apollo – Carlos Martinez – Medium

  • Mocking API responses with React ApolloApollo Client and the GraphQL tools that have been made open source within the last years are pretty awesome, the community that is being builded around them is great.
  • However, as with every new technology, there are a lot of things that need to mature and improve.Documentation on testing is definitely one of the bits that needs a lot of improvements, it isn’t clear what to do, and I personally found myself digging into the source code to understand what to do.One of the problems I faced was that I wanted to use mock responses when testing my app components, and there are at least two ways of doing this:The first way is to use graphql-tools.
  • From their docs:This package allows you to use the GraphQL schema language to build your GraphQL.js schema, and also includes useful schema tools like per-type mocking.You can use this library together with a custom MockNetworkInterface to return mocked responses to your components:const { mockServer } = require(“graphql-tools”);const { print } = MockNetworkInterface { constructor(schema, mocks = {}) { if (!
  • schema) { throw new Error(‘Cannot create Mock Api without specifying a schema’); } this.mockServer = mockServer(schema, mocks); } query(request) { return request.variables); }}This is nice, and very flexible, with graphql-tools you can do pretty much whatever you do in your actual API.What I didn’t like about this approach is that you need your schema in sync with the schema defined in your API (you can do this making an instrospection query to your backend), I also found this approach overcomplicates things unnecessarily.The second (and simpler) approach I found was to use the mockNetworkInterface class, this class is defined in react-apollo/test-utils, you can have a peek on it here.To use it, you first need to define some Mock Requests (these requests need to be exactly the same your components will make):const GraphQLMocks = [ { request: { query: UserProfileQuery, variables: {} }, result: { data: { current_user: { id: 1, first_name: ‘Foo’, last_name: ‘Bar’, email: ‘foo@example.com’ } } } }];The UserProfileQuery is exported from your component:export const UserProfileQuery = gql` query userProfile { current_user { id first_name last_name email } }`;And this is how you use it to setup your tests:import { mockNetworkInterface } from ApolloClient from ‘apollo-client’;import { ApolloProvider } from ‘react-apollo’;import { mount } from ‘enzyme’;import App from ‘.
  • /App.js’;import React from ‘react’;const setupTests = () = { const networkInterface = // or mocks); const client = new ApolloClient({ networkInterface, addTypename: false }); const wrapper = mount( ApolloProvider client={client} App / /ApolloProvider ); return { wrapper };};It is important that you pass addTypename: false to ApolloClient, otherwise you would have to include a __typename field in all your mocks and queries.Now any queries your components make will be handled by your mocked responses, you have full control of what you want to return.And that’s it!

Apollo Client and the GraphQL tools that have been made open source within the last years are pretty awesome, the community that is being builded around them is great. However, as with every new…
Continue reading “Mocking API responses with React Apollo – Carlos Martinez – Medium”

React.js: The Hard Parts

State Management without #Redux:  #ReactJS #Javascript

  • If a user interacts with your application or refreshes the page, then we’ll look up state at that moment and rebuild the page.
  • In dynamic apps, like ones built using React, state change has to be dealt with immediately.
  • Managing state can get complicated if each component has some state.
  • Interaction with the components, like a mouse click, trigger these functions to update state.
  • For example to implement retweets:

    When the state is updated, the props will change too and render the child components again.

I am a full-stack software developer and passionate educator. I have been building for the web for almost two decades.
Continue reading “React.js: The Hard Parts”

React.js: The Hard Parts

  • If a user interacts with your application or refreshes the page, then we’ll look up state at that moment and rebuild the page.
  • In dynamic apps, like ones built using React, state change has to be dealt with immediately.
  • Managing state can get complicated if each component has some state.
  • Interaction with the components, like a mouse click, trigger these functions to update state.
  • For example to implement retweets:

    When the state is updated, the props will change too and render the child components again.

I am a full-stack software developer and passionate educator. I have been building for the web for almost two decades.
Continue reading “React.js: The Hard Parts”