Putting together a bunch of components, a bunch of files, and building an application
Let's build a server that some sort of front-end or other back-end could interface
User experience design is a huge industry in and of itself.
Putting your application on the web is a small part of what a DevOps engineer would do.
A person who can sort of dip into both ends of those two separate tasks.
Someone you go to when anything breaks down
Someone who can really work with servers
Able to take code and put it live on the internet and distribute across multiple platforms and systems and ensure that it works
create-react-app netlify-demo
cd netlify-demo
yarn
import React, { Component } from 'react';
import './App.css';
import StarWarsList from './StarWarsList';
class App extends Component {
render() {
return (
<div classname="App>
<header className="App-header">
<h1 className="App-title"> Ryan's Star Wars Project</h1>
</header>
<StarWarsList />
</div>
);
}
}
export default App;
Fetch API - not available in Node (have to use a package in Node if you want to use it)
import Read, { Component } from 'react';
class StarwarsList extends Component {
constructor() {
super();
this.state = {
starWarsChars: []
}
}
componentDidMount() {
fetch('https://swapi.co/api/people')
.then(res => {
return res.json();
})
.then(chars => {
const starWarsChars = chars.results;
this.setState({
starWarsChars: starWarsChars
})
})
.catch(err => {
console.log(err)
});
}
render() {
return (
<ul>
{this.state.starWarsChars.map(char => {
return <li key={char.url}>{char.name}</li><div> THIS IS OUR LIST </div>
})}
</ul>
)
}
}
export default StarWarsList;
.App {
tex-align: center;
}
.App-header {
background-color: #e3e3;
height: 150px;
padding: 20px;
color: white
}
.App-title {
font-size: 2em;
}
.App-intro {
font-size: large;
}
li {
list-style: none
}
First, need to publish on git.
git init
git add .
git commit -m 'initialized home layout'
git remote add origin https://github.com/ryanhca/netlify-sw.git
git push -u origin master
With create-react-app, everything's built in for you. Only a few tweaks you need to do to get your code available to the world wide web
New site from git
"If you are using a static site generator or build tool, we'll need these settings to build your site"
If you run the build command in the application, it will generate a build directory for you.
publish directory
webpack is a tool that takes all of your code, bundles it up and spits it out into a single bundle file.
The URL netlify generates is an adoring-neumann URL
Deploy log - the screen you're looking for to see what's going write or wrong
Build is doing "react-scripts build"
Continuous Build Feature
Build & deploy
(From Netlify Docs:)
For anything larger than a one page landing, you really should be using a static site generator or a front-end build like grunt or gulp
If you're working on another branch, it will only update if merged to master
Someone posted in slack at the end saying:
FYI If you use <BrowserRouter> you have to have a file in your public folder called _redirects with /* /index .... will not work
Think the full statement might have been (based on this documentation):
FYI If you use
you have to have a file in your public folder called _redirects with /* /index.html 200
or it will not work