Volunteer portal for community arts festivals, built on React and Node
- Install Node
- Install Yarn
git clone [email protected]:Hyperborea-Experimental-Arts-Team/volunteer-portal.git
cd volunteer-portal
yarn install
- NodeJS - Server-side javascript runtime environment
- Babel - Javascript compiler
- Express - Web framework running on NodeJS, serves the API and the React SPA
- Redux - State management library that enforces uni-directional data flow
- React - Library for building declarative user interfaces
- Storybook - Environment for viewing and testing React components in isolation
volunteer-portal/
config/ - Configuration files
public/ - Static files that don't get processed by React
scripts/ - Support scripts for build/test/deploy tasks
src/ - Uncompiled source code
server/ - Source for the server application
client/ - Source for the client application
actions/ - Redux actions
components/ - React presentational components
containers/ - React container components
images/ - Images needed by React components
reducers/ - Redux reducers
stories/ - Component definitions for Storybook
In the project directory, you can run:
Runs the entire application in development mode. Changes in the source will be visible without rebuilding, and changes to the React application will be hot-reloaded.
The React application will start on port 3000, with the API on port 3001.
Open http://localhost:3000 to view it in the browser.
Builds the entire application into a production-ready bundle.
Starts the application server in development mode, hosting the API only. Changes in the source will be visible without rebuilding. You probably don't want to run this by itself, because it will be unable to route to the React front-end.
For development, you should just run yarn start
Builds the server application into a production-ready bundle.
Doesn't exist! Someone should probably write tests for the server...
Starts the React application in development mode. Changes to the source will be hot-reloaded without rebuilding. You probably don't want to run this by itself, because the API will not be online.
For development, you should just run yarn start
Builds the client application into a production-ready bundle.
Launches the test runner for the client application in interactive watch mode. See the section about running tests for more information.
Launches the storybook environment, allowing you to view and interact with React components without running the actual app.
Jest is being used as a test runner. Jest is a Node-based runner, so tests are run in a Node environment and not in the browser. It is primarily intended to be used for unit testing of logic and components.
Jest will look for test files with any of the following popular naming conventions:
- Files with
.js
suffix in__tests__
folders. - Files with
.test.js
suffix. - Files with
.spec.js
suffix.
The .test.js
/ .spec.js
files (or the __tests__
folders) can be located at any depth under the src
top level folder.
To create tests, add it()
(or test()
) blocks with the name of the test and its code. You may optionally wrap them in describe()
blocks for logical grouping but this is neither required nor recommended.
Jest provides a built-in expect()
global function for making assertions. A basic test could look like this:
import sum from './sum';
it('sums numbers', () => {
expect(sum(1, 2)).toEqual(3);
expect(sum(2, 2)).toEqual(4);
});
All expect()
matchers supported by Jest are extensively documented here.
You can also use jest.fn()
and expect(fn).toBeCalled()
to create “spies” or mock functions.
$ docker build -t nyan .
$ docker run -p 3000:3001 -t nyan
First time:
$ docker-compose up
After editing the app server source or Dockerfile:
$ docker-compose build; docker-compose up