Giter Site home page Giter Site logo

olebedev / go-starter-kit Goto Github PK

View Code? Open in Web Editor NEW
2.8K 97.0 360.0 10.87 MB

[abandoned] Golang isomorphic react/hot reloadable/redux/css-modules/SSR starter kit

License: Other

Makefile 7.61% Go 44.80% JavaScript 39.39% CSS 2.25% HTML 5.95%
golang react redux isomorphic universal server-side-rendering components browser

go-starter-kit's Introduction

go-starter-kit wercker status Join the chat at https://gitter.im/olebedev/go-starter-kit

This project contains a quick starter kit for Facebook React Single Page Apps with Golang server side render via goja javascript engine, implemented in pure Golang and also with a set of useful features for rapid development of efficient applications.

What it contains?

  • server side render via goja
  • api requests between your react application and server side application directly via fetch polyfill
  • title, Open Graph and other domain-specific meta tags render for each page at the server and at the client
  • server side redirect
  • embedding static files into artefact via bindata
  • high performance echo framework
  • advanced cli via cli
  • Makefile based project
  • one(!) terminal window process for development
  • routing via react-router
  • ES6 & JSX via babel-loader with minimal runtime dependency footprint
  • redux as state container
  • redux-devtools
  • css styles without global namespace via PostCSS, css-loader & css-modules
  • separate css file to avoid FOUC
  • hot reloading via react-transform & HMR
  • webpack bundle builder
  • eslint and golint rules for Makefile

Workflow dependencies

Note that probably not works at windows.

Project structure

The server's entry point
$ tree server
server
├── api.go
├── app.go
├── bindata.go <-- this file is gitignored, it will appear at compile time
├── conf.go
├── data
│   └── templates
│       └── react.html
├── main.go <-- main function declared here
├── react.go
└── utils.go

The ./server/ is flat golang package.

The client's entry point

It's simple React application

$ tree client
client
├── actions.js
├── components
│   ├── app
│   │   ├── favicon.ico
│   │   ├── index.js
│   │   └── styles.css
│   ├── homepage
│   │   ├── index.js
│   │   └── styles.css
│   ├── not-found
│   │   ├── index.js
│   │   └── styles.css
│   └── usage
│       ├── index.js
│       └── styles.css
├── css
│   ├── funcs.js
│   ├── global.css
│   ├── index.js
│   └── vars.js
├── index.js <-- main function declared here
├── reducers.js
├── router
│   ├── index.js
│   ├── routes.js
│   └── toString.js
└── store.js

The client app will be compiled into server/data/static/build/. Then it will be embedded into go package via go-bindata. After that the package will be compiled into binary.

Convention: javascript app should declare main function right in the global namespace. It will used to render the app at the server side.

Install

Clone the repo:

$ git clone [email protected]:olebedev/go-starter-kit.git $GOPATH/src/github.com/<username>/<project>
$ cd $GOPATH/src/github.com/<username>/<project>

Install dependencies:

$ make install

Run development

Start dev server:

$ make serve

that's it. Open http://localhost:5001/(if you use default port) at your browser. Now you ready to start coding your awesome project.

Build

Install dependencies and type NODE_ENV=production make build. This rule is producing webpack build and regular golang build after that. Result you can find at $GOPATH/bin. Note that the binary will be named as the current project directory.

License

MIT

go-starter-kit's People

Contributors

comerc avatar franklinkim avatar gitter-badger avatar javiercbk avatar joelnb avatar matsu911 avatar olebedev avatar readmecritic avatar rtuin avatar smd686s avatar ufukomer 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  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

go-starter-kit's Issues

Devtools update

Need to update DevTool for the latest version. Could you @zoetrope send a PR with these changes? As I see you already did it at your fork. Thanks.

Cannot Import Absolute Path

Using Golang 1.7.1 on Mac OSX 10.11.6.
Cloned go-starter-kit to $GOPATH/src/github.com/<username>/<projectname>

Followed build instructions with npm i -> srlt restore -> make serve
Also tried make install -> make serve

Either way, I get the following error with make serve:

go install /Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on
can't load package: package /Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on: import "/Users/foo/Documents/Programming/go/src/github.com/foo/go-starter-kit/vendor/github.com/olebedev/on": cannot import absolute path
make: *** [/Users/foo/Documents/Programming/Go/bin/on] Error 1

"panic recover interface conversion: interface is *errors.errorString, not string" when sending get request

I am trying to serve the app on vm ubuntu x64 using vagrant. After install Go v1.7.1, Node.Js v6.7.0 I set enviropment variables: export GOPATH=pwd export PATH=$PATH:$GOPATH/bin export GO15VENDOREXPERIMENT=1 cd bin export GOBIN=$(pwd) export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin.
Then I was installed all dependencies runing make install and build it by make build.
When I start the server using make serve, it start's successfull. Terminal shows me ==> 🌎 Listening on port 5001. Open up http://localhost:5001/ in your browser. , but when I making request in browser to localhost:5001 the terminal shows me 500 error of GET request and I received panic recover interface conversion: interface is *errors.errorString, not string stack trace 8250 bytes in my browser.
I gave 4GB memory for vagrant, because, if I used less, I received "Cannot allocate memory".
image

Can't get it to boot

Hash: 8771430a13b6b6e77fc1
Version: webpack 1.12.13
Time: 113278ms
     Asset     Size  Chunks             Chunk Names
 bundle.js  1.37 MB       0  [emitted]  bundle
bundle.css  9.44 kB       0  [emitted]  bundle
    + 772 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
/Users/leswan/bin/go-bindata -pkg=main -prefix=server/data -debug -o=server/bindata.go server/data/...
cat: .pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
# github.com/anthony/goreact/server
usage: 6l [options] main.6
  -1    use alternate profiling code
  -8    assume 64-bit addresses
  -B info
        define ELF NT_GNU_BUILD_ID note
  -C    check Go calls to C code
  -D addr
        data address
  -E sym
        entry symbol
  -I interp
        set ELF interp
  -L dir
        add dir to library path
  -H head
        header type
  -K    add stack underflow checks
  -O    print pc-line tables
  -Q    debug byte-register code gen
  -R rnd
        address rounding
  -S    check type signatures
  -T addr
        text address
  -V    print version and exit
  -W    disassemble input
  -X name value
        define string data
  -Z    clear stack frame on entry
  -a    disassemble output
  -c    dump call graph
  -d    disable dynamic executable
  -extld ld
        linker to run in external mode
  -extldflags ldflags
        flags for external linker
  -f    ignore version mismatch
  -g    disable go package data checks
  -installsuffix suffix
        pkg directory suffix
  -k sym
        set field tracking symbol
  -linkmode mode
        set link mode (internal, external, auto)
  -n    dump symbol table
  -o outfile
        set output file
  -r dir1:dir2:...
        set ELF dynamic linker search path
  -race
        enable race detector
  -s    disable symbol table
  -shared
        generate shared object (implies -linkmode external)
  -tmpdir dir
        leave temporary files in this directory
  -u    reject unsafe packages
  -v    print link trace
  -w    disable DWARF generation
make: *** [/Users/leswan/bin/goreact] Error 2

unrecognized package

go get app/...
package golang.org/x/net/context: unrecognized import path "golang.org/x/net/context"
package golang.org/x/net/publicsuffix: unrecognized import path "golang.org/x/net/publicsuffix"

make serve
cleaned
62% 62/71 build modulesContainer#eachAtRule is deprecated. Use Container#walkAtRules instead.
Container#eachRule is deprecated. Use Container#walkRules instead.
Container#eachDecl is deprecated. Use Container#walkDecls instead.
Node#style() is deprecated. Use Node#raw()
Container#remove is deprecated. Use Container#removeChild
64% 64/71 build modulesNode#before is deprecated. Use Node#raws.before
Hash: ad1be354968dcbacaf4f
Version: webpack 1.12.1
Time: 9441ms
Asset Size Chunks Chunk Names
[email protected] 204 kB [emitted]
[email protected] 205 bytes [emitted]
../../bundle.server.js 1.11 MB 0, 1 [emitted] ../../bundle.server
bundle.js 1.11 MB 1, 0 [emitted] bundle
bundle.css 4.23 kB 0, 1, 1, 0 [emitted] ../../bundle.server, bundle
+ 358 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 3 hidden modules
/Users/zhangsailei/golang/bin/go-bindata -pkg=server -prefix=src/app/server/data -debug -o=src/app/server/bindata.go src/app/server/data/...
cat: .pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
can't load package: package app: cannot find package "app" in any of:
/usr/local/go/src/app (from $GOROOT)
/Users/zhangsailei/golang/src/app (from $GOPATH)
make[1]: *** [restart] Error 1
make: *** [serve] Error 2

Unable to run `make serve` following instructions in README

I get three compiler errors around g-bindata:

  1. src/github.com/dimroc/go-starter-kit/src/app/server/app.go:64: undefined: Asset
  2. src/github.com/dimroc/go-starter-kit/src/app/server/app.go:65: undefined: AssetDir
  3. src/github.com/dimroc/go-starter-kit/src/app/server/react.go:191: undefined: Asset

I have done nothing with the included deps.json, which is where I should probably start looking. My experience with go dependencies is with Godep however, which isn't being used here.

Details below:

dimroc@Dimitris-MBP-2: go-starter-kit (master)$ go version
go version go1.5.1 darwin/amd64

dimroc@Dimitris-MBP-2: go-starter-kit (master)$ make serve
cleaned
 61% 64/75 build modulesContainer#eachAtRule is deprecated. Use Container#walkAtRules instead.
Container#eachRule is deprecated. Use Container#walkRules instead.
Container#eachDecl is deprecated. Use Container#walkDecls instead.
Node#style() is deprecated. Use Node#raw()
Container#remove is deprecated. Use Container#removeChild
 62% 65/75 build modulesNode#before is deprecated. Use Node#raws.before
Hash: 4d7d9421b397e0839078
Version: webpack 1.12.2
Time: 4274ms
                                        Asset       Size  Chunks             Chunk Names
[email protected]     204 kB          [emitted]
 [email protected]  205 bytes          [emitted]
                                    bundle.js    1.12 MB       0  [emitted]  bundle
                                   bundle.css    4.23 kB       0  [emitted]  bundle
    + 359 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 3 hidden modules
/Users/dimroc/go_workspace/src/github.com/dimroc/go-starter-kit/bin/go-bindata -pkg=server -prefix=src/app/server/data -debug -o=src/app/server/bindata.go src/app/server/data/...
cat: .pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
# github.com/dimroc/go-starter-kit/src/app/server
src/github.com/dimroc/go-starter-kit/src/app/server/app.go:64: undefined: Asset
src/github.com/dimroc/go-starter-kit/src/app/server/app.go:65: undefined: AssetDir
src/github.com/dimroc/go-starter-kit/src/app/server/react.go:191: undefined: Asset
make[1]: *** [restart] Error 2
make: *** [serve] Error 2

Setup Instructions Not Working

Hi, I cloned the repo and ran make install, which does not return any errors, but when I run make serve I get:

'go install /Users/Emmett/Desktop/go-starter-kit/vendor/github.com/olebedev/on
can't load package: package /Users/Emmett/Desktop/go-starter-kit/vendor/github.com/olebedev/on: import "/Users/Emmett/Desktop/go-starter-kit/vendor/github.com/olebedev/on": cannot import absolute path
make: *** [/bin/on] Error 1

Any idea what is causing this? Thanks!

local import "./server" in non-local package

I've decided to create my own issue ticket so that we can solve the most pressing concerns of this start kit so that I can contribute as well because I really like the idea I just think it needs a little bit more documentation.

on make serve I get the output

go-starter-kit kielan$ make serve
cleaned
Hash: 7cfc13abe9c261045111  
Version: webpack 1.12.12
Time: 2770ms
     Asset     Size  Chunks             Chunk Names
 bundle.js  1.27 MB       0  [emitted]  bundle
bundle.css  9.44 kB       0  [emitted]  bundle
    + 527 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
golang_projects/bin/go-bindata -pkg=server -prefix=server/data -debug -o=server/bindata.go server/data/...
cat: .pid: No such file or directory
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
restart the app...
can't load package: golang_projects/src/github.com/olebedev/go-starter-kit/main.go:6:2: local import "./server" in non-local package
make[1]: *** [restart] Error 1
make: *** [serve] Error 2

Not sure what the ./server being referred to as non-local package means.

GSK does not build after fresh pull

# app/server
src/app/server/app.go:64: undefined: Asset
src/app/server/app.go:65: undefined: AssetDir
src/app/server/react.go:191: undefined: Asset

Looks like the file declaring Asset and AssetDir may not have been added when commiting c6c0ff5. Or maybe I am just being daft.

Websockets

Could you extend the server with support for Websockets?

Makefile:19: *** target pattern contains no `%'. Stop.

I am transitioning from Java to Go, trying to build a web application with some UI.

After cloning repo I am running make install, but I am getting this error.

Makefile:19: *** target pattern contains no `%'. Stop.

Please let me know if I have missed anything.

SSR and store changes

I'm experiencing an issue with SSR that's driving me mad. I've added authentication to this app and I'm storing a cookie with the auth token (JWT). The token is being passed down the pipe to the Go server so that I can actually send it to the JSVM when performing server side rendering.

This is working fine as the value of the cookie is available in the VM and I can read and log it to the console to check that it's actually there.

I then changed the toString.js to dispatch my loginSuccess action creator when the token is available.

My toString is the following:

import React from 'react';
import { Provider } from 'react-redux';
import { renderToString } from 'react-dom/server';
import { match, RouterContext } from 'react-router';
import Helmet from 'react-helmet';
import cookie from 'react-cookie';
import createRoutes from './routes';
import { createStore, setAsCurrentStore } from '../store';

/**
 * Handle HTTP request at Golang server
 *
 * @param   {Object}   options  request options
 * @param   {Function} cbk      response callback
 */
export default function (options, cbk) {
  cbk = global[cbk];
  let result = {
    uuid: options.uuid,
    app: null,
    title: null,
    meta: null,
    initial: null,
    error: null,
    redirect: null,
    token: options.token,
  };

  const store = createStore();
  setAsCurrentStore(store);

  try {
    match({ routes: createRoutes({store, first: { time: false }}), location: options.url }, (error, redirectLocation, renderProps) => {
      try {
        if (error) {
          result.error = error;

        } else if (redirectLocation) {
          result.redirect = redirectLocation.pathname + redirectLocation.search;

        } else {

          console.log('token');
          let token = options.token;
          console.log(options.token);
          if (token !== null) {
            store.dispatch(loginUserSuccess(token));
          }

          result.app = renderToString(
            <Provider store={store}>
              <RouterContext {...renderProps} />
            </Provider>
          );
          const { title, meta } = Helmet.rewind();
          result.title = title.toString();
          result.meta = meta.toString();
          result.initial = JSON.stringify(store.getState());
        }
      } catch (e) {
        result.error = e;
      }
      return cbk(result);
    });
  } catch (e) {
    result.error = e;
    return cbk(result);
  }
}

The problem is that the store.dispatch(loginUserSuccess(token)); line is breaking something even though there's no error or warning anywhere.
Basically if I try to access directly http://localhost:5001/usage the response of the /api/v1/system/conf call is completely missing. If I remove that line it works again but then all my authentication flow is being ignored just like I was an anonymous user.

What am I doing wrong?

Store not getting set on client side during SSR

So my mind is kind of being blown right now. I have some code that is essentially copy and pasted from the usage example, but the result from my fetch is not getting stored in the redux store on the client side. I log the data in each step along the way from the then from my fetch in the onEnter method to the redux action to the reducer then to the render for the component. On the server side I see all the correct data being logged but on the client side the store is empty(I don't see any of the data being logged along the way on the client side because thats happening on the server).

// onEnter for the page. just recieves some data to be presented 
static onEnter({store, nextState, replaceState, callback}) {
    fetch('/api/page/home').then(r => r.json())
      .then(res => {
        store.dispatch(setHomepageData(res));
        callback();
      });
  }

// the route in routes.js
<IndexRoute component={isLoggedIn(Homepage)} onEnter={w(Homepage.onEnter)} />

isLoggedIn is just a HOC that passes me a prop telling me if there is a user logged in by looking for the jwt in localStorage. This can't be the problem because I wrapped the Usage component in it too and that still works fine. (<Route path="/usage" component={isLoggedIn(Usage)} onEnter={w(Usage.onEnter)} />)

Redux stuff...

// inside actions.js
export function setHomepageData(data) {
  return { type: SET_HOMEPAGE_DATA, payload: data };
}

// inside reducers.js
function content(state = {}, action) {
  switch (action.type) {
    case SET_HOMEPAGE_DATA:
      return action.payload;
    default:
      return state;
  }
}

export default combineReducers({config, content});

What is mind boggling is that the usage example works just fine and I literally basically copy and pasted. My api endpoint is working correctly(used postman to test). Also if I navigate from another page causing this to not be the initial load, everything works just fine.

Any ideas what could be causing this?

Thanks in advance for any response and thanks for the great starter kit!

undefined: Asset

Followed instructions and ...

ezeql@desktop ~/work/go-starter-kit $ go get app
# app/server
src/app/server/app.go:103: undefined: Asset
src/app/server/app.go:104: undefined: AssetDir
src/app/server/app.go:117: undefined: Asset
src/app/server/app.go:144: undefined: Asset
src/app/server/app.go:144: undefined: AssetDir

setup issues

go: 1.5.1
node: v0.12.7

Installing and grabbing the node mobules seems ok:

gedw99-MacBook-Pro:x apple$ pwd
/Users/apple/Workspace/go/x
gedw99-MacBook-Pro:x apple$ git clone https://github.com/olebedev/go-starter-kit.git
Cloning into 'go-starter-kit'...
remote: Counting objects: 487, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 487 (delta 0), reused 0 (delta 0), pack-reused 484
Receiving objects: 100% (487/487), 392.55 KiB | 621.00 KiB/s, done.
Resolving deltas: 100% (211/211), done.
Checking connectivity... done.
gedw99-MacBook-Pro:x apple$ ls
go-starter-kit
gedw99-MacBook-Pro:x apple$ cd go-starter-kit/
gedw99-MacBook-Pro:go-starter-kit apple$ ls
Makefile        package.json        webpack.hot.config.js
README.md       src
deps.json       webpack.config.js
gedw99-MacBook-Pro:go-starter-kit apple$ npm i
npm WARN package.json [email protected] No repository field.
npm WARN peerDependencies The peer dependency eslint@>=0.8.0 || ~1.0.0-rc-0 included from eslint-plugin-react will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency 
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated [email protected]: Deprecated.

> [email protected] install /Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack-dev-server/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node

> [email protected] install /Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack-dev-server/node_modules/socket.io/node_modules/engine.io/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node

> [email protected] install /Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack-dev-server/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/bufferutil
> node-gyp rebuild

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node

> [email protected] install /Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack-dev-server/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/node_modules/utf-8-validate
> node-gyp rebuild

  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
-
> [email protected] install /Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents
> node-pre-gyp install --fallback-to-build

[fsevents] Success: "/Users/apple/Workspace/go/x/go-starter-kit/node_modules/webpack/node_modules/watchpack/node_modules/chokidar/node_modules/fsevents/lib/binding/Release/node-v14-darwin-x64/fse.node" is installed via remote
[email protected] node_modules/expose-loader

[email protected] node_modules/whatwg-fetch

[email protected] node_modules/when

[email protected] node_modules/lodash

[email protected] node_modules/react-router
├── [email protected]
└── [email protected]

[email protected] node_modules/react-hot-loader
├── [email protected]
└── [email protected] ([email protected])

[email protected] node_modules/flummox
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

[email protected] node_modules/babel-eslint
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/extract-text-webpack-plugin
├── [email protected]
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/style-loader
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/file-loader
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/babel-loader
├── [email protected]
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/stylus-loader
├── [email protected]
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/react
└── [email protected] ([email protected], [email protected])

[email protected] node_modules/react-helmet
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
└── [email protected]

[email protected] node_modules/webpack-dev-server
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/autoprefixer-loader
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/css-loader
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/eslint
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

[email protected] node_modules/eslint-plugin-react

[email protected] node_modules/babel-core
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected]

[email protected] node_modules/webpack
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected])

Grabbing the golang side of things works. Apart from Assets (known issue).
But make serve bails on me:


gedw99-MacBook-Pro:go-starter-kit apple$ ls
Makefile        node_modules        webpack.config.js
README.md       package.json        webpack.hot.config.js
deps.json       src
gedw99-MacBook-Pro:go-starter-kit apple$ export GOPATH=`pwd`
gedw99-MacBook-Pro:go-starter-kit apple$ echo $GOPATH
/Users/apple/Workspace/go/x/go-starter-kit
gedw99-MacBook-Pro:go-starter-kit apple$ ls
Makefile        node_modules        webpack.config.js
README.md       package.json        webpack.hot.config.js
deps.json       src
gedw99-MacBook-Pro:go-starter-kit apple$ go get app/...
# app/server
src/app/server/app.go:64: undefined: Asset
src/app/server/app.go:65: undefined: AssetDir
src/app/server/react.go:191: undefined: Asset
gedw99-MacBook-Pro:go-starter-kit apple$ go get github.com/jteeuwen/go-bindata/...
gedw99-MacBook-Pro:go-starter-kit apple$ make serve
cleaned
 50% 64/96 build modulesContainer#eachAtRule is deprecated. Use Container#walkAtRules instead.
Container#eachRule is deprecated. Use Container#walkRules instead.
Container#eachDecl is deprecated. Use Container#walkDecls instead.
Node#style() is deprecated. Use Node#raw()
Container#remove is deprecated. Use Container#removeChild
 51% 67/96 build modulesNode#before is deprecated. Use Node#raws.before
Hash: 17313310ffc9804cfb06  
Version: webpack 1.12.2
Time: 5412ms
                                        Asset       Size  Chunks             Chunk Names
[email protected]     204 kB          [emitted]  
 [email protected]  205 bytes          [emitted]  
                                    bundle.js    1.12 MB       0  [emitted]  bundle
                                   bundle.css    4.23 kB       0  [emitted]  bundle
    + 359 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 3 hidden modules
/Users/apple/Workspace/go/x/go-starter-kit/bin/go-bindata -pkg=server -prefix=src/app/server/data -debug -o=src/app/server/bindata.go src/app/server/data/...
make[1]: /Users/apple/Workspace/go/x/go-starter-kit/bin/go-bindata: No such file or directory
make[1]: *** [src/app/server/bindata.go] Error 1
make: *** [serve] Error 2
gedw99-MacBook-Pro:go-starter-kit apple$ 


Install Not Working - Echo

Went through install instructions on README on fresh go 1.6 install. On MAKE SERVE it is crashing stating "cannot find pkg github.com/labstack/echo" in "vendor/gopkg.in/labstack/echo.v1/middleware/auth.go:7:2"

Of course if you do a "go get" on that package it crashes with all kinds of error messages. What's the best way to get past this error?

Build failed following the Readme

When i run the go get app is will tips:
~GOPATH git:(master) go get app

app/server

src/app/server/app.go:65: undefined: Asset
src/app/server/app.go:66: undefined: AssetDir
src/app/server/app.go:72: undefined: Asset
src/app/server/app.go:72: undefined: AssetDir
src/app/server/react.go:185: undefined: Asset

but when i ran the make serve ,it still success. then i ran the go get app, all good.
do you encounter the same situation?

[Document]I think there should be some document on the onEnter part...

I have encountered lots of bugs related with onEnter method. All those bugs are caused by my code, but I see no error message on the console:(..

To successfully debug the bug in the onEnter method, one should be warned that even a small syntax error will result in malfunction and the server side rendering will not work. Hence, one should run the code on the client side first and then move to the onEnter part.

And the router params should be written done on the readme.md to tell the users where to find the url parameters, i.e. nextState.params.xxx.

I would like to say this is really a nice starer kit :)

Easy way to turn off server side JS rendering

I'm running into JS issues when trying to render the JS on the golang server via duktape.

Is there a line of code I can comment out or a command line I can use to toggle off server side JS rendering? I've been mucking around in here:

case re := <-vm.Handle(map[string]interface{}{

I'm ultimately trying to use redux with react-router with redux-simple-router, but it doesn't render server side.

I'm merely looking for something to unblock me at this point.

interface conversion: interface is runtime.errorString, not string

When trying to run after successful build, the site displays:

panic recover
 interface conversion: interface is runtime.errorString, not string
 stack trace 5869 bytes
 goroutine 4 [running]:
go-starter-kit/vendor/github.com/labstack/echo/middleware.Recover.func1.1.1(0xc82020a180)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/middleware/recover.go:20 +0xa9
main.(*React).Handle.func1(0xc82020a180, 0xc8200141d0)
    /Users/hemantasapkota/go/src/go-starter-kit/server/react.go:56 +0xad
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape%2ev2._cgoCheckPointer0(0x44b8520, 0xc82002a018, 0x0, 0x0, 0x0, 0x4491220)
    go-starter-kit/vendor/gopkg.in/olebedev/go-duktape.v2/_obj/_cgo_gotypes.go:114 +0x4d
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).PushPointer(0xc82002a018, 0xc82002a018)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/gopkg.in/olebedev/go-duktape.v2/api.go:1450 +0x9c
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).PushGoFunction(0xc82002a018, 0x4735798, 0xa)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/gopkg.in/olebedev/go-duktape.v2/duktape.go:87 +0xf1
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).PushGlobalGoFunction(0xc82002a018, 0x465d960, 0xa, 0x4735798, 0xc82000e301, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/gopkg.in/olebedev/go-duktape.v2/duktape.go:70 +0x1ca
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).PushTimers(0xc82002a018, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:19 +0xe2
go-starter-kit/vendor/gopkg.in/olebedev/go-duktape-fetch%2ev2.PushGlobal(0xc82002a018, 0x5908c58, 0xc820144fd0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/gopkg.in/olebedev/go-duktape-fetch.v2/fetch.go:24 +0x25
main.newReactVM(0xc82011d380, 0x16, 0x5908c58, 0xc820144fd0, 0xc82005d458)
    /Users/hemantasapkota/go/src/go-starter-kit/server/react.go:156 +0x103
main.(*onDemandPool).get(0xc82011d540, 0x47358f8)
    /Users/hemantasapkota/go/src/go-starter-kit/server/react.go:209 +0x44
main.(*React).Handle(0xc8201fc060, 0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/server/react.go:61 +0x146
main.NewApp.func4.1(0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/server/app.go:126 +0x293
go-starter-kit/vendor/github.com/labstack/echo.wrapHandlerFuncMW.func1.1(0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/echo.go:656 +0x7d
go-starter-kit/vendor/github.com/labstack/echo.wrapHandlerFuncMW.func1.1(0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/echo.go:656 +0x7d
go-starter-kit/vendor/github.com/labstack/echo/middleware.Recover.func1.1(0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/middleware/recover.go:25 +0x66
go-starter-kit/vendor/github.com/labstack/echo/middleware.Logger.func1.1(0xc82020a180, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/middleware/logger.go:28 +0x12a
go-starter-kit/vendor/github.com/labstack/echo.(*Echo).ServeHTTP(0xc820144fd0, 0x4ca51a8, 0xc82020e000, 0xc820208000)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/echo.go:542 +0x2ac
net/http.serverHandler.ServeHTTP(0xc8200b4d80, 0x4ca51a8, 0xc82020e000, 0xc820208000)
    /Users/hemantasapkota/go1.5/src/net/http/server.go:1883 +0x19e
net/http.(*conn).serve(0xc820202000)
    /Users/hemantasapkota/go1.5/src/net/http/server.go:1374 +0xc7d
created by net/http.(*Server).Serve
    /Users/hemantasapkota/go1.5/src/net/http/server.go:1941 +0x478

goroutine 1 [IO wait]:
net.runtime_pollWait(0x5909eb8, 0x72, 0x5900000)
    /Users/hemantasapkota/go1.5/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc82018cdf0, 0x72, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc82018cdf0, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).accept(0xc82018cd90, 0x0, 0x5909fb0, 0xc82000a200)
    /Users/hemantasapkota/go1.5/src/net/fd_unix.go:408 +0x27c
net.(*TCPListener).AcceptTCP(0xc8200820d0, 0x4060f40, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/tcpsock_posix.go:254 +0x4d
net/http.tcpKeepAliveListener.Accept(0xc8200820d0, 0x0, 0x0, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/http/server.go:2190 +0x41
net/http.(*Server).Serve(0xc8200b4d80, 0x5909f78, 0xc8200820d0, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/http/server.go:1918 +0x129
net/http.(*Server).ListenAndServe(0xc8200b4d80, 0x0, 0x0)
    /Users/hemantasapkota/go1.5/src/net/http/server.go:1899 +0x136
go-starter-kit/vendor/github.com/labstack/echo.(*Echo).run(0xc820144fd0, 0xc8200b4d80, 0x0, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/echo.go:586 +0xb0
go-starter-kit/vendor/github.com/labstack/echo.(*Echo).Run(0xc820144fd0, 0xc820192930, 0x5)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/labstack/echo/echo.go:561 +0x5e
main.(*App).Run(0xc82011d560)
    /Users/hemantasapkota/go/src/go-starter-kit/server/app.go:138 +0xb8
main.RunServer(0xc82011f0e0)
    /Users/hemantasapkota/go/src/go-starter-kit/server/main.go:37 +0x60
go-starter-kit/vendor/github.com/codegangsta/cli.Command.Run(0x4649578, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4651d80, 0xb, 0x0, ...)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/codegangsta/cli/command.go:137 +0x1081
go-starter-kit/vendor/github.com/codegangsta/cli.(*App).Run(0xc82011eea0, 0xc820086000, 0x2, 0x2, 0x0, 0x0)
    /Users/hemantasapkota/go/src/go-starter-kit/vendor/github.com/codegangsta/cli/app.go:176 +0xffa
main.Run(0xc820086000, 0x2, 0x2)
    /Users/hemantasapkota/go/src/go-starter-kit/server/main.go:28 +0xfb
main.main()
    /Users/hemantasapkota/go/src/go-starter-kit/server/main.go:10 +0x3b

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /Users/hemantasapkota/go1.5/src/runtime/asm_amd64.s:1988 +0x1

Why are you skipping the first call to onEnter?

I am trying to understand this part of the code:

https://github.com/olebedev/go-starter-kit/blob/master/client/router/routes.js#L18

Why are you skipping the first call to the onEnter function on the components? I feel like this is leading to some weird errors on my side. Maybe it's not related, but I'm not sure.

I added JWT authentication and there's a login component on the homepage. When I login successfully, it redirects to a new page (called gallery in my case) where the onEnter function actually grabs some data from an authenticated web service.

It looks like the call to that web service is being skipped. If I go back to the homepage and login again (and thus get redirected to the gallery page) this time it works fine.

Maybe that's completely unrelated but eventually you might know what's going on. Cheers!

update echo web framework

Thanks, Olebedev.
I installed go-starter-kit on my mac book after check some issues that posted before.
I have one request,
Echo is updated to v2.0, there are some issues to update echo in go-starter-kit.
Please help me, can you update the go-starter-kit with echo 2.0?

Thanks,

Ignore go build failure in makefile

Hi,
there seems to be a problem when you modify go code, and makefile tries to rebuild server. If there is any compile time error the makefile recipe crashes.

Possible soultion would be prefixing build command with - :
-@go build -ldflags '$(LDFLAGS)' -o $@ $(IMPORT_PATH)/server

Failed build will be ignored this way and old binary would be used

cannot import absolute path

sorry ,i am a newerr. when i make serve,i got this problem.
my system is win10 and have cygwin env.

image
image
image
image

sorry my poor english, best regards

command "make serve" is failed.

1

1

Hello, I tried to make server by using go-starter-kit.
I success "slrt restore" comand and it made vendor directory in go-start-kit directory.
Actually, I copied and past your released slrt binary file to the go-start-kit root directory and execute "slrt command".
Next, I installed MINGW for GNUMake in the windows. and tried make command.
In that time, I faced the above issue. What is wrong with it?

PS: I tried on the mac os too, but issue is same.

Why does go-starter-kit need to be installed in $GOPATH/src?

I don't need a full explanation if someone could just point me to some code or docs, but I'm trying to understand why go-starter-kit needs to be installed in $GOPATH/src.

I have a production react on rails project that is having some performance issues (shocker I know). I'm attempting to use have rails redirect slow routs to this project. Overtime I'd like to move off rails completely. I've seen articles where other people have migrated from rails I route at a time over an extended time so I have reason to believe it will work, but nothing where both projects are using react.

It would make sense to have the go-starter-kit run in the same directory as the current rails code so they can share the react components during the transition. The need to install to $GOPATH/src seems confusing and somewhat inconvenient to me. If I could understand why it is being done it would help me make good decisions moving forward.

Thanks in advance.

connect ECONNREFUSED 127.0.0.1:5000

when i make serve, the output is :

Error: connect ECONNREFUSED 127.0.0.1:5000
at Object.exports._errnoException (util.js:856:11)
at exports._exceptionWithHostPort (util.js:879:20)
at TCPConnectWrap.afterConnect as oncomplete

i type lsof -i:5000, nothing output.

Segfault in go-duktape when onEnter() subscribes to state

My use case is: I'm testing a method of pre-fetching API data server side.

Inside the component's onEnter() I dispatch an async action (using redux-thunk) to fetch it, subscribe to state so I can wait for it to complete before calling callback().

In doing so, I found duktape predictably segfaulting.

In order to reproduce it, I ported what I'm doing over to your Usage component example, and used setTimeout to fake the async nature of it. So, I modify the onEnter code to be like this:

  static onEnter({store, nextState, replaceState, callback}) {
      const conf = {this: "that"}
      let waitAttempts = 1;
      store.subscribe(function () {
        console.log(JSON.stringify(store.getState()));
        if (--waitAttempts == 0) callback();
      });

      store.dispatch(setConfig(conf));
      setTimeout(() => {
        store.dispatch(setConfig(conf));
      }, 0);
      setTimeout(() => {
        store.dispatch(setConfig(conf));
      }, 0);
  }

It seems to be that running the callback() whilst there are still outstanding async actions may be the cause; if you change waitAttempts to 3 it doesn't crash. If you run it as is, you get this:

{"config":{"this":"that"},"dialog":false,"articles":{}}
action @ 19:08:44.767 SET_CONFIG
%c prev state color: #9E9E9E; font-weight: bold [object Object]
%c action color: #03A9F4; font-weight: bold [object Object]
%c next state color: #4CAF50; font-weight: bold [object Object]
—— log end ——
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7fff824fe5d3]

runtime stack:
runtime.throw(0x4550fa9, 0x2a)
	/usr/local/go/src/runtime/panic.go:566 +0x95
runtime.sigpanic()
	/usr/local/go/src/runtime/sigpanic_unix.go:12 +0x2cc

goroutine 40 [syscall, locked to thread]:
runtime.cgocall(0x43f1800, 0xc4200a36c8, 0xc400000000)
	/usr/local/go/src/runtime/cgocall.go:131 +0x110 fp=0xc4200a3680 sp=0xc4200a3640
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2._Cfunc_duk_get_prop(0x4f04f20, 0xfffffffe, 0x0)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/_obj/_cgo_gotypes.go:1534 +0x4d fp=0xc4200a36c8 sp=0xc4200a3680
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).GetProp(0xc420146038, 0xfffffffffffffffe, 0x453d1db)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/api.go:514 +0x85 fp=0xc4200a3710 sp=0xc4200a36c8
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).putTimer(0xc420146038, 0x3ff0000000000000)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:133 +0x8c fp=0xc4200a3748 sp=0xc4200a3710
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.setTimeout.func1(0x3ff0000000000000, 0xc420146038, 0x3ff0000000000000)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:53 +0xc7 fp=0xc4200a37a8 sp=0xc4200a3748
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc4200a37b0 sp=0xc4200a37a8
created by /workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.setTimeout
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:58 +0xab

goroutine 1 [IO wait]:
net.runtime_pollWait(0x4c490d8, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:160 +0x59
net.(*pollDesc).wait(0xc42015ffe0, 0x72, 0xc42004d518, 0xc4200120a8)
	/usr/local/go/src/net/fd_poll_runtime.go:73 +0x38
net.(*pollDesc).waitRead(0xc42015ffe0, 0x4768180, 0xc4200120a8)
	/usr/local/go/src/net/fd_poll_runtime.go:78 +0x34
net.(*netFD).accept(0xc42015ff80, 0x0, 0x47669c0, 0xc4205bc4c0)
	/usr/local/go/src/net/fd_unix.go:419 +0x238
net.(*TCPListener).accept(0xc42002c0e8, 0x60, 0x78, 0xc4200a4100)
	/usr/local/go/src/net/tcpsock_posix.go:132 +0x2e
net.(*TCPListener).AcceptTCP(0xc42002c0e8, 0x29e8d60800, 0xc42004d640, 0x4020a28)
	/usr/local/go/src/net/tcpsock.go:209 +0x49
/workspace/go-react-test/vendor/github.com/labstack/echo.tcpKeepAliveListener.Accept(0xc42002c0e8, 0x4060aa0, 0xc42004d680, 0xc42004d688, 0xc42004d678)
	/workspace/go-react-test/vendor/github.com/labstack/echo/echo.go:651 +0x2f
/workspace/go-react-test/vendor/github.com/labstack/echo.(*tcpKeepAliveListener).Accept(0xc42002c0f0, 0x45839a0, 0xc4200a4100, 0x476b8c0, 0xc4201d2a50)
	<autogenerated>:103 +0x52
net/http.(*Server).Serve(0xc4200b5200, 0x476ab00, 0xc42002c0f0, 0x0, 0x0)
	/usr/local/go/src/net/http/server.go:2273 +0x1ce
/workspace/go-react-test/vendor/github.com/labstack/echo.(*Echo).StartServer(0xc4200b96c0, 0xc4200b5200, 0xc420166b90, 0x5)
	/workspace/go-react-test/vendor/github.com/labstack/echo/echo.go:586 +0x506
/workspace/go-react-test/vendor/github.com/labstack/echo.(*Echo).Start(0xc4200b96c0, 0xc420166b90, 0x5, 0xc420166a08, 0x4)
	/workspace/go-react-test/vendor/github.com/labstack/echo/echo.go:536 +0x53
main.(*App).Run(0xc4200edd20)
	/workspace/go-react-test/server/app.go:144 +0xbe
main.RunServer(0xc4200bd2c0)
	/workspace/go-react-test/server/main.go:36 +0x4b
/workspace/go-react-test/vendor/github.com/codegangsta/cli.HandleAction(0x44a03e0, 0x4583780, 0xc4200bd2c0, 0xc420070600, 0x0)
	/workspace/go-react-test/vendor/github.com/codegangsta/cli/app.go:487 +0x7c
/workspace/go-react-test/vendor/github.com/codegangsta/cli.Command.Run(0x453ab6c, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x454075e, 0xb, 0x0, ...)
	/workspace/go-react-test/vendor/github.com/codegangsta/cli/command.go:207 +0xb96
/workspace/go-react-test/vendor/github.com/codegangsta/cli.(*App).Run(0xc4200b9520, 0xc42000c240, 0x2, 0x2, 0x0, 0x0)
	/workspace/go-react-test/vendor/github.com/codegangsta/cli/app.go:250 +0x812
main.Run(0xc42000c240, 0x2, 0x2)
	/workspace/go-react-test/server/main.go:27 +0x10d
main.main()
	/workspace/go-react-test/server/main.go:10 +0x45

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2086 +0x1

goroutine 16 [runnable]:
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2._Cfunc_GoString(0x4f045e0, 0xffffffff, 0x4f045e0)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/_obj/_cgo_gotypes.go:139
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).SafeToString(0xc42002c070, 0xffffffffffffffff, 0x453b347, 0x4)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/api.go:1283 +0x98
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).castStringToError(0xc42002c070, 0x1, 0x1, 0x0)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/api.go:902 +0x257
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.(*Context).PevalString(0xc42002c070, 0xc42012a0b0, 0xab, 0x0, 0x0)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/api.go:880 +0x103
main.(*ReactVM).Handle(0xc420013760, 0xc4201d6330, 0xc4200496c8)
	/workspace/go-react-test/server/react.go:198 +0x118
main.(*React).Handle(0xc4201d28a0, 0x4771ae0, 0xc4201e40e0, 0x0, 0x0)
	/workspace/go-react-test/server/react.go:69 +0x3a7
main.NewApp.func4.1(0x4771ae0, 0xc4201e40e0, 0x4, 0x44ee140)
	/workspace/go-react-test/server/app.go:131 +0x13e
main.NewApp.func3.1(0x4771ae0, 0xc4201e40e0, 0x3, 0x44be1a0)
	/workspace/go-react-test/server/app.go:94 +0x8d
main.NewApp.func2.1(0x4771ae0, 0xc4201e40e0, 0x4583420, 0x1000)
	/workspace/go-react-test/server/app.go:85 +0x88
/workspace/go-react-test/vendor/github.com/labstack/echo/middleware.RecoverWithConfig.func1.1(0x4771ae0, 0xc4201e40e0, 0x0, 0x0)
	/workspace/go-react-test/vendor/github.com/labstack/echo/middleware/recover.go:82 +0x124
/workspace/go-react-test/vendor/github.com/labstack/echo/middleware.LoggerWithConfig.func2.1(0x4771ae0, 0xc4201e40e0, 0x0, 0x0)
	/workspace/go-react-test/vendor/github.com/labstack/echo/middleware/logger.go:111 +0x186
/workspace/go-react-test/vendor/github.com/labstack/echo.(*Echo).ServeHTTP.func1(0x4771ae0, 0xc4201e40e0, 0xc4200b9718, 0x4533040)
	/workspace/go-react-test/vendor/github.com/labstack/echo/echo.go:519 +0x11e
/workspace/go-react-test/vendor/github.com/labstack/echo.(*Echo).ServeHTTP(0xc4200b96c0, 0x476aec0, 0xc420072270, 0xc4200f03c0)
	/workspace/go-react-test/vendor/github.com/labstack/echo/echo.go:528 +0x229
net/http.serverHandler.ServeHTTP(0xc4200b5200, 0x476aec0, 0xc420072270, 0xc4200f03c0)
	/usr/local/go/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc4200a4100, 0x476b800, 0xc4200f4340)
	/usr/local/go/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
	/usr/local/go/src/net/http/server.go:2293 +0x44d

goroutine 41 [semacquire]:
sync.runtime_Semacquire(0xc4205bc604)
	/usr/local/go/src/runtime/sema.go:47 +0x30
sync.(*Mutex).Lock(0xc4205bc600)
	/usr/local/go/src/sync/mutex.go:85 +0xd0
/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.setTimeout.func1(0x3ff0000000000000, 0xc420146040, 0x4000000000000000)
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:45 +0x72
created by /workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape%2ev2.setTimeout
	/workspace/go-react-test/vendor/gopkg.in/olebedev/go-duktape.v2/timers.go:58 +0xab

Apologies if this is not in the right spot as I'm not sure if it's a bug in my usage, go-starter-kit, the go-duktape binding, or maybe even duktape itself.

Can this run on heroku?

Since this uses duktape which is an embeddable C program, would it run on a single process heroku instance?

support for code splitting

Been trying too hard to achieve code splitting but can't get my way around the window undefined error when rendering on the server.

Is there any way to achieve code splitting using webpack's require.ensure.
or probably another method to circumvent that error.

slow performance

Awesome work !

But a bit slow (just 16 resp/sec)

ab -n 1000 -c 64 http://localhost:5001/
This is ApacheBench, Version 2.3 <$Revision: 1663405 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 100 requests
......
Completed 1000 requests
Finished 1000 requests

Server Software:
Server Hostname:        localhost
Server Port:            5001

Document Path:          /
Document Length:        1519 bytes

Concurrency Level:      64
Time taken for tests:   59.692 seconds
Complete requests:      1000
Failed requests:        813
   (Connect: 0, Receive: 0, Length: 813, Exceptions: 0)
Total transferred:      1687799 bytes
HTML transferred:       1527799 bytes
Requests per second:    16.75 [#/sec] (mean)
Time per request:       3820.269 [ms] (mean)
Time per request:       59.692 [ms] (mean, across all concurrent requests)
Transfer rate:          27.61 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       2
Processing:  1987 3766 277.8   3795    4348
Waiting:     1987 3766 277.8   3795    4347
Total:       1987 3766 277.8   3796    4349

Percentage of the requests served within a certain time (ms)
  50%   3796
  66%   3870
  75%   3920
  80%   3956
  90%   4037
  95%   4095
  98%   4166
  99%   4221
 100%   4349 (longest request)

Errors during first request of development server

It looks like make serve starts everything up nicely but upon the first request the go server panics and throws a TypeError

panic: TypeError: Not a function: [object Object]

goroutine 9 [running]:
main.newJSVM.func1(0xc420014600)
	/Users/nanno/go/src/github.com/nanno77/houston/server/react.go:199 +0x4d1
github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).RunOnLoop.func1()
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:109 +0x31
github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).run(0xc42018e340, 0xc42018e601)
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:116 +0x77
created by github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop.(*EventLoop).Start
	/Users/nanno/go/src/github.com/nanno77/houston/vendor/github.com/dop251/goja_nodejs/eventloop/eventloop.go:87 +0x44

I can't for the life of me figure out where this is going wrong. make install works without any errors, even make build works, but upon running the server the error is thrown.

I would love to play with this project a little bit. If someone has any thoughts please let me know.

Resolving promises in onEnter()

Is there any way to resolve promises in onEnter() when calling it from the server? I'd like my components to fetch some data before rendering but I'm facing an issue.

If I add the fetch data stuff as a promise with something along the line of store.dispatch(loadData()); it works fine on the client but since it returns a Promise, it doesn't work on the server.

On the other hand if I move the code of my loadData function directly into onEnter it does get called on the server as well as I'm calling fetch() directly instead of returning it, but then React complains that the HTML being created on the client is different from the one on the server.

Is there a smart way to accomplish this?

go get app/ undefined: Asset

Any idea why this is happening on fresh clone?

bash-3.2$ go get app
# app/server
src/app/server/app.go:64: undefined: Asset
src/app/server/app.go:65: undefined: AssetDir
src/app/server/react.go:191: undefined: Asset

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.