/generator-koa-react

A yeoman generator for creating a stack with react powered by koa

Primary LanguageJavaScriptMIT LicenseMIT

generator-koa-react NPM version Build Status Dependency Status Coverage percentage

A yeoman generator for using react backed by koa

Check out the generated boilerplate at https://github.com/doug-wade/example-koa-react.

Installation

First, install Yeoman and generator-koa-react using npm (we assume you have pre-installed node.js).

npm install -g yo
npm install -g generator-koa-react

Then generate your new project:

yo koa-react

Getting Started

To start the server, just run npm start and navigate to localhost:3000 in your favorite browser.

To install the build toolchain

npm install -g gulp bunyan babel

Directory structure

browser <- the javascript source files for the browser
build <- transpiled server-side javascript
public <- files that are served by koa (compiled js, preprocessed css, compressed html)
server <- the javascript source files for the server
styles <- the styles, preprocessed
test <- tests and fixtures
view <- the html

Because we serve using browserify, the node api is available in the browser the same as on the server, so the distinction between browser and server is a little hazy, and you can free require between them and reasonably expect it to work.

Running the tests

To run the tests, run npm test, or gulp build && gulp test, or ava test/*.js.

When debugging the tests, note that the tranpiler doesn't output debugger statements, so you'll need to place them in the transpiled js in build/, or place them in the browser.

More in depth

To develop against the stack, you may also want to familiarize yourself with some of the tools here. Here are some relevant links

Getting To Know Yeoman

Yeoman has a heart of gold. He's a person with feelings and opinions, but he's very easy to work with. If you think he's too opinionated, he can be easily convinced. Feel free to learn more about him.

License

MIT © Doug Wade