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
{ | |
"name": "wp-api", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"dependencies": { | |
"alt": "^0.18.6", | |
"axios": "^0.15.3", | |
"lodash": "^4.17.4", | |
"react": "^15.4.2", |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>WP API</title> | |
</head> | |
<body> | |
<div id="app"></div> <!-- This div will be holding the app --> | |
<script src="bundle.js"></script> <!-- This is the main JS file that gets bundled by webpack --> | |
</body> | |
</html> |
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 webpack = require('webpack'); | |
var path = require('path'); | |
module.exports = { | |
devtool: 'inline-source-map', // This will show line numbers where errors are accured in the terminal | |
devServer: { | |
historyApiFallback: true, // This will make the server understand "/some-link" routs instead of "/#/some-link" | |
}, | |
entry: [ | |
'webpack-dev-server/client?http://127.0.0.1:8080/', // Specify the local server port |
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
import React from 'react'; | |
import {render} from 'react-dom'; | |
import App from './components/App.js'; | |
import Home from './components/Home.js'; | |
import { | |
browserHistory, | |
IndexRoute, | |
Redirect, | |
Route, |
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
import React from 'react'; | |
export default class App extends React.Component { | |
constructor(props) { | |
super(props); | |
} | |
render() { | |
return ( |
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
import React from 'react'; | |
class Home extends React.Component { | |
render() { | |
return ( | |
<div> | |
<h1>Hello World</h1> | |
</div> | |
); |
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
import Alt from 'alt'; | |
const alt = new Alt(); | |
export default alt; |
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
import axios from 'axios'; | |
import alt from './../alt/alt.js'; | |
class DataActions { | |
constructor() { | |
const appUrl = 'http://wordpress-installation-example-url.com'; // Replace this with your WP installation url | |
this.pagesEndPoint = `${appUrl}/wp-json/wp/v2/pages`; // Endpoint for getting Wordpress Pages | |
this.postsEndPoint = `${appUrl}/wp-json/wp/v2/posts`; // Endpoint for getting Wordpress Posts |
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
import alt from './../alt/alt.js'; | |
import DataActions from './../actions/DataActions.js'; | |
class DataStore { | |
constructor() { | |
this.data = {}; | |
this.bindListeners({ | |
// Listen to the getSuccess() in DataActions.js | |
handleSuccess: DataActions.GET_SUCCESS |
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
import React from 'react'; | |
import {render} from 'react-dom'; | |
import App from './components/App.js'; | |
import Home from './components/Home.js'; | |
import DataActions from './actions/DataActions.js'; | |
import { | |
browserHistory, | |
IndexRoute, | |
Redirect, |
OlderNewer