GithubHelp home page GithubHelp logo

hardwarehandler's Introduction

Newline Guide to Modernizing an Enterprise React App - Hardware Handler

Welcome to Hardware Handler: the sample React application for the newline Guide to Modernizing an Enterprise React app.

Application Purpose & General Structure

Since this course is focused on modernizing an enterprise-style React application it's built in the style of a full-stack React application (client/ folder housing the React application code and server/ folder housing the Node.js/Express application code), however, when you look in the server/ folder, the only files present are a package.json and db.orig.json file.

The server Folder

This server/ folder exists entirely to provide data (courtesy of the JSON Server NPM package to simulate the CRUD (create, read, update, delete) functionality that would be present if the client/ folder was connecting to multiple, real REST API microservices.

The JSON Server provides a quick backend for prototyping or mocking (or in this case, powering a sample app). And once the server/ folder's JSON Server starts up, a new local db file is created (db.json) that keeps track of any updates made to the data via REST endpoints while the app is running.

Once the application shuts down and the server's turned off, the db.json file is no longer referenced. And when the application starts again, the original state of the data will be restored from the db.orig.json file.

The client Folder

The client/ folder is where the bulk of this course happens. The frontend's built off an older version of Create-React-App (react-scripts v1.1.4 and react / react-dom v16.4.1). Suffice it to say, it's pre-React Hooks, which were introduced with the release react v16.8.0.

For this reason, the application components that depend on state are built as class-based components using React lifecycle methods. The src/ folder is the main star here.

Most of these stateful components are filed in the src/containers/ folder. The components only displaying views and data passed to them are in the src/components/ folder. The data fetching calls, utilizing the axios NPM package, are all stored in the src/services/ folder and there's a few helper functions and constants stored in their respective folders that are utilized throughout the app.

Redux is not included as it was unnecessary for this application (and the argument could be made it is unneccessary for many React application it's introduced to).

And because the application is written with such an old version of CRA (a version so old SASS was not easy to set up), the styling is written with vanilla CSS. In a true production app, this would probably be supplemented with LESS, SASS, or CSS-in-JS, but for simplicity, to focus on the "React" part, vanilla CSS suffices and suitably separates the JavaScript code from the styling, which should make understanding and refactoring things a little easier.

How To Install & Run Locally

Ok, now on to the local installation and startup.

First, it's recommended to run a stable version of Node.js v12 or above, and a version of Yarn v1 or above.

After cloning this repo, open up the command line and cd into the server/ folder. When your file path in the command line looks like hardware-handler-0/server run the command yarn.

Once that command has finished installing, cd .. back to the root of the project, then cd client. Now, when your command line file path looks like hardware-handler-0/client run the command yarn again. This should install all the client-side React dependencies.

After both folders have successfully installed, run yarn start in the command line, while still in the client/ folder.

If all goes according to plan, a browser window with the URL http://localhost:3000 should open up, and the "Welcome to Hardware Handler!" home screen should show up.# hardwareHandler

hardwarehandler's People

Contributors

r83wheeler avatar

Watchers

 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.