Code Monkey home page Code Monkey logo

hapi-universal-redux's Introduction

logo dependencies devDependencies

DEPRECATED: check out alternatives to building a server-side rendered React app:

Isomorphic starterkit with server-side React rendering using npm, webpack, webpack-dev-server, react-transform-hmr, hapi, babel, react, react-router redux, redux-devtools-extension, react-router-redux, radium.

screenshot

Features

  • Fully automated with npm run scripts
  • Server hot reloads with webpack hmr
  • Webpack for watch + production builds
  • React + Router on the client and server
  • React-Transform for instant client updates
  • Babel automatically compiles ES6 + ES7
  • Redux and Redux-DevTools-Extension for managing app state
  • Radium for advanced inline styling

It just works out-of-the-box.

Installation

Make sure you're using Node >= 4.0.0.

	git clone https://github.com/luandro/hapi-universal-redux.git
	cd hapi-universal-redux

	npm install
	npm run dev     # start Hapi server and webpack-dev-server hot server

	# production build and run
	npm run production
	# or
	NODE_ENV=production npm run build
	NODE_ENV=production npm run start

Usage

Run npm run dev in your terminal and play with views/Main.js to get a feel of the server-side rendering and client-side hot updates.

License

MIT license. Copyright © 2016, Luandro. All rights reserved.

hapi-universal-redux's People

Contributors

andreigec avatar eventhough avatar framp avatar greenkeeperio-bot avatar joeframbach avatar kutzi avatar luandro avatar mozmorris avatar pwmckenna avatar rickwong avatar sbrudz avatar sergel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hapi-universal-redux's Issues

Heroku failing with R10 (Boot timeout) Error

Heroku logs:

2015-11-08T01:00:55.503717+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-11-08T01:00:55.503717+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-11-08T01:00:56.126572+00:00 heroku[web.1]: State changed from starting to crashed
2015-11-08T01:00:56.115875+00:00 heroku[web.1]: Process exited with status 137

SyntaxError: Use of const in strict mode.

Got this error when trying to boot...

[piping] can't execute file: /Users/johnpaulnarowski/Dev/projects/hapi-universal-redux/babel.server.js
[1] [piping] error given was: /Users/johnpaulnarowski/Dev/projects/hapi-universal-redux/node_modules/hapi/lib/index.js:5
[1] const Server = require('./server');
[1] ^^^^^
[1] SyntaxError: Use of const in strict mode.
[1] at exports.runInThisContext (vm.js:73:16)
[1] at Module._compile (module.js:443:25)
[1] at Module._extensions..js (module.js:478:10)
[1] at Object.require.extensions.(anonymous function) as .js
[1] at Module.load (module.js:355:32)
[1] at Module._load (module.js:310:12)
[1] at Function.module._load (/Users/johnpaulnarowski/Dev/projects/hapi-universal-redux/node_modules/piping/lib/launcher.js:32:16)
[1] at Module.require (module.js:365:17)
[1] at require (module.js:384:17)
[1] at Object. (/Users/johnpaulnarowski/Dev/projects/hapi-universal-redux/src/server.js:7:13)
[1] [piping] further repeats of this error will be suppressed...
[1] [piping] File src/server.js has changed, reloading.
[1] [piping] File babel.server.js has changed, reloading.

Using Hapi

How do you use Hapi with React and Redux?

Is this correct?

Reac <> Redux <> Hapijs <> Data Source?

or I'm wrong? please describe.

Multiple issues

When cloning and attempting to run this project currently, there are multiple issues.

The first is error given was: Error: Unknown handler: proxy which is the Github route part from server.js#35. I just commented it out to see if I could get this running.

Then, I encountered TypeError: Uncaught error: reply.file is not a function on server.js#28 which is due to this repo now using a version of hapi.js that requires you to register the Inert plugin. That's easy to fix, so I did that. I think this is due to something else being broken as the original project and other forks do not include Inert (but I haven't figured out how everything is working enough yet.)

Then there's the Router.run part in server.js#61. React-router 1.x no longer has the run function. So the code needs to be updated or react-router needs to be downgraded to 0.13.

Are any of these issues going to be fixed? Did you realize these are problems? I can offer to fix some, but I'm new to React/Redux so fixing others is a bit above me at this exact moment.

Running over domain

How can I run this over a domain?

Actually everything goes well but the hot reloading

Browser's Network tab requests the incorrect url:

http://localhost:8080/sockjs-node/info?t=1452504544593

Thanks

Getting 403 error in the browser whenever I change something on the Client.

Hello!

Server-side hot-updates work perfectly.

However, whenever I change something in one of my Actions, Components, Containers, I am getting 403 error in the browser.

More specifically, it is JSON:

  {"statusCode":403,"error":"Forbidden"}

I can still see my file on port 8080, but app on 8000 is a no go.

Debugging server.js file

Just need some guidance on how to debug app/server.js code. How can I properly set breakpoints and debug this file? I tried node-inspector but having some issues with it.

I used an index.js file to bootstrap server.js:

index.js

require('babel-core/register');  
require('./server.js');  

and then ran node src/index.js. This is after including .babelrc and all the presets.

I get the error:

hapi-universal-redux/src/actions/StargazersActions.js:18
if (__CLIENT__) {
    ^

ReferenceError: __CLIENT__ is not defined
    at Object.<anonymous> (StargazersActions.js:8:5)
    at Module._compile (module.js:397:26)
    at loader (/Users/**/IsoReactEx/hapi-universal-redux/node_modules/babel-register/lib/node.js:128:5)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/**/IsoReactEx/hapi-universal-redux/node_modules/babel-register/lib/node.js:138:7)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/**/IsoReactEx/hapi-universal-redux/src/containers/StargazersContainer.js:19:26)
    at Module._compile (module.js:397:26)

Can someone explain this error?

Server-side React render being discarded after reload.

Server-side loading happens smoothly on the first attempts, but after a few reloads it gets discarded. Logs this:

Warning: flattenChildren(...): Encountered two children with the same key, `.$535988`. Child keys must be unique; when two children share a key, only the first child will be used.

sass setup

I'm not sure Radium is the best option for larger scaled web-apps. I think it'd be best for a sass setup to be implemented?

Thoughts?

how do you "set" a server-side object?

lets say I want to pull an instagram user feed, then I make a new object formatted the way I like.
How do I do this as a hapi route?
For simplicity, lets say I want this object to be sent to the Home.js component.

I know I can do a GET request from a react component, but I'm not trying to do AJAX, I would like the object from server-side so the information is there when the first page load happens.

also unrelated note, the README says /views/Main.js , when it should be /srv/components/Home.js

Does not work on Windows

C:\ws\hapi-universal-redux>npm run dev

> [email protected] dev C:\ws\hapi-universal-redux
> node ./node_modules/concurrently/src/main.js --kill-others "npm run watch-client" "npm run start"

[0] Active code page: 65001
[1] Active code page: 65001
[1]
[1] > [email protected] start C:\ws\hapi-universal-redux
[1] > NODE_PATH="./src" node ./babel-server
[1]
[1] 'NODE_PATH' is not recognized as an internal or external command,
[1] operable program or batch file.
[1]
[1] npm
[1]  ERR! Windows_NT 10.0.10586
...

The issue seems to be inherited from RickWong/react-isomorphic-starterkit, which has had it from it's incarnation. I created an issue about it that breaks it down and offers 2 solutions:

Does not work on Windows #88

I hope it can help you make this work on Windows as well.
Good luck and thanks for this project!

Invalid checksum on Community avatars.

Warning: React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:
 (client) 2.3">Community</h3></div></div></div></d
 (server) 2.3">Community</h3><a href="https://gith

This happens if the route is changed while avatars are being loaded, or if it's loaded a second time.

Clientside JS errors don't appear to be shown.

Hi,

I've just started using this project as I try to get up to speed on React.

What i've noticed (since I'm making a lot of errors), is that if I mess up certain things in /src/components, I am not notified anywhere about the cause or even that there is an error.

For instance I imported a library incorrectly, using import xyz from ... rather than import default - I see that in the console, but if I have a method with some invalid syntax, I don't see it.

I would expect the console to show a compile error as I believe the scripts are being run through babel which would catch it.

This seems like a bug. It's making progress very difficult.

Add code-splitting

Thinking on using the implementation from here, which will also solve #91.

Another another alternative might be using bundle-loader, as explained here, which also gives an example on how to solve server-side.

Any suggestions are welcome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.