Giter Club home page Giter Club logo

pwa-react-test's Introduction

pwa-react-test

This is a test PWA made with ReactJs. It has a login page that lets you enter user/password and a Welcome page that displays the time passed since your last login.

It comes with a ServiceWorker that caches all the static files.

The server is mocked with a json-server. It will always return OK to all the calls to /login. To start the server see the "how to run locally section".

How to run it locally

First install dependencies:

npm install

To run in dev mode mode you will need 2 different shells. The first command will launch the frontend, the sencond launches the fake server:

npm start
npm run server

Then go to http://localhost:3000

Server will run in the port 8080.

To create a production build:

npm run build

Testing

To run unit tests:

npm test

Roadmap

If this proyect should grow in the future, this is the roadmap of the features I would add:

  • deployment
  • a11y
  • i18n
  • e2e test
  • improve seccurity and add a real backend

Other considerations

It is all in the "main" branch because I was working alone. I would have used feature branches otherwise.

The login and router parts are very simple because I considered that this project didn't need further complexity. In a bigger project, I would have chosen a real router and better security. It only stores the login date in the sessionStorage as there are no further backend calls.

Also, the data model was too simple to use the context api or redux. I decided to store the info in the parent components and the sessionStorage.

Besides, the URL of the "backend" is hardcoded. It should depend on a external baseUrl that changes between environments.

The project was originally created from scratch with snowpack, but I finally changed to create-react-app to add the service worker because of the support it provides and the little time to do it.

pwa-react-test's People

Contributors

sergiomunicio avatar sergiotx avatar

Watchers

James Cloos avatar  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.