Git Product home page Git Product logo

react-webpack-boilerplate's Introduction

react-webpack-boilerplate

A Boilerplate for ReactJS + Webpack 4 + React Router 4 and Redux

Tech used:

Usage

clone the repo using SSH:

git clone git@github.com:ricpumanes/react-webpack-boilerplate.git

or

clone the repo using HTTPS:

git clone https://github.com/ricpumanes/react-webpack-boilerplate.git

install dependencies

npm install

start the app locally (development mode):

npm run dev

build (production mode):

npm run prod

test:

npm test

watch test:

npm run test:watch

Testing Async (with Feathers JS):

import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk'; // if you are using thunk middleware
import * as actions from 'path-to-module-actions';
import app from 'path-to-my-feathers-config';

const middlewares = [thunk];
const mockStore = configureStore(middlewares);
const store = mockStore();

const userAccount = {
  email: '[email protected]',
  password: '12345678',
};

describe("Login Async Action", () => {
  it("should return AUTH_LOGIN_SUCCESS if Login was successful", () => {
    const expected = [
      { type: 'AUTH_LOGIN', payload: userAccount },
      { type: 'AUTH_LOGIN_SUCCESS', payload: userAccount },
    ];
    // stab the service
    app.authenticate = jest.fn(() => {
      return Promise.resolve();
    });
    
    return store.dispatch(actions.login(userAccount)).then(() => {
      expect(store.getActions()).toEqual(expected);
    });
  });
});

Simulate Production Build

1. build project first

npm run prod

2. generate self-signed certificates (key and cert)

openssl req -nodes -new -x509 -keyout server.key -out server.cert

3. simulate

npm run simulate

Finally, open on app on https://localhost:5000 or on the PORT you set

TODO:

react-webpack-boilerplate's People

Contributors

ricpumanes avatar

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.