Skip to content

mcaupybugs/reactjs-nodejs-rest-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation


React.Js/Node.Js Project

## Quick start
  1. FrontEnd part: cd Frontend Run npm run setup to install dependencies
    Run npm start for development
    Run npm run build for production
    Run npm run test for testing
  2. BackEnd part: cd Backend Run npm install to install dependencies
    Run npm start for development
    Run npm run prod for production
    Run npm run test for testing

Frontend

Authentication
Only User page needs authentication and `redux-auth-wrapper` high order component library is wrapped that page for authentication. Trying access to Users page without authentication, HOC will redirect to login page and login page validates token in sessionStorage if exist. If it not exist, client stays in login page. If re-login successful, re-direct again to desired page.
Home, Login and Contact pages validate jwt token in mount state.
Credentials are email:[email protected], password:secret
Styling
Styles are in global-styles.js file which provide css injection to `head` tag
Sagas
For side effects, `redux-saga` is implemented. All the actions are sync and sagas listens stores and actions and catch the desired requests then fires back the request results
Main saga is in App container.This saga runs all the time, but other sagas destroy themselves after page change.
Proxy
All sagas uses '/api/*' paths for server. In development frontend node.js server rewrites all request to '/api/* -> /*' and backend server only handles '/*'.

Backend

ES6
Babel compiler implemented for es6 features
Any DB system not included, only endpoints
/contact endpoint only logs datas, no saving or validation

Please note that there are only 2 React components and 3 endpoints have unit tests.

About

React.Js and Node.Js Rest Api example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 90.9%
  • HTML 7.9%
  • ApacheConf 1.2%