Function
| Static Public Summary | ||
| public |
createBuilder(target: string, rocBuilder: rocBuilder, resolver: string): rocBuilder Creates a builder. |
|
| public |
createClient(options: rocClientOptions) Client entry point for React applications. |
|
| public |
createReduxStore(reducers: object, middlewares: ...function): function Redux store creator |
|
| public |
createRoutes(routes: function): function Route creator |
|
| public |
getResolvePath(resolvePaths: ...string): string Used on the server to find all dependecies. |
|
| public |
Read stats from build |
|
| public |
Enhances a server instance with React support. |
|
Static Public
public createBuilder(target: string, rocBuilder: rocBuilder, resolver: string): rocBuilder source
import createBuilder from 'roc-web-react/lib/builder/index.js'Creates a builder.
Params:
| Name | Type | Attribute | Description |
| target | string |
|
a target: should be either "client" or "server" |
| rocBuilder | rocBuilder | A rocBuilder to base everything on. |
|
| resolver | string |
|
Path to the resolver for the server side getResolvePath |
public createClient(options: rocClientOptions) source
import createClient from 'roc-web-react/src/app/client/index.js'Client entry point for React applications.
Params:
| Name | Type | Attribute | Description |
| options | rocClientOptions | Options for the client |
Example:
import { createClient } from 'roc-web-react/app/client';
const server = createClient({
createRoutes: routes,
createStore: store,
mountNode: 'application'
});
public createReduxStore(reducers: object, middlewares: ...function): function source
import {createReduxStore} from 'roc-web-react/src/app/shared/flux/create-store.js'Redux store creator
Return:
| function | A function that has the following interface:
|
public createRoutes(routes: function): function source
import createRoutes from 'roc-web-react/src/app/shared/create-routes.js'Route creator
Params:
| Name | Type | Attribute | Description |
| routes | function |
|
A function that takes a reference to potential store and returns a React Router route |
Return:
| function | A function that takes a reference to a potential store, runs the |
public getResolvePath(resolvePaths: ...string): string source
import getResolvePath from 'roc-web-react/lib/helpers/get-resolve-path.js'Used on the server to find all dependecies.
When creating a extension of this project this needs to be extended.
Params:
| Name | Type | Attribute | Description |
| resolvePaths | ...string | Paths to be resolved. |
public readStats(stats: string): object source
import readStats from 'roc-web-react/lib/helpers/read-stats.js'Read stats from build
Params:
| Name | Type | Attribute | Description |
| stats | string | Path to a stats file from the client build |
public useReact(createServer: function): function source
import useReact from 'roc-web-react/src/app/server/index.js'Enhances a server instance with React support.
Extends the options object from roc-web. See rocServerOptions for what the new options are.
Params:
| Name | Type | Attribute | Description |
| createServer | function | A createServer function to wrap and add extra functionallity to |
Return:
| function | Returns a new createServer that can be used to create server instances that can manage React applications |
Example:
import { createServer } from 'roc-web/app';
import { useReact } from 'roc-web-react/app/server';
const server = useReact(createServer)({
serve: 'files',
createRoutes: routes,
createStore: store,
stats: './stats.json'
});
server.start();