Skip to content

Web front-end built during the Rocketseat Bootcamp #11

License

Notifications You must be signed in to change notification settings

DiegoVictor/gobarber-web

Repository files navigation

[Web] GoBaber

AppVeyor typescript react styled-components eslint airbnb-style jest coverage MIT License PRs Welcome

This web version allow providers to register yourself, change or reset password, update name and email, update avatar and see your schedules. All the resources used by this application comes from its API.

Table of Contents

Screenshots

Click to expand.

Installing

Easy peasy lemon squeezy:

$ yarn

Or:

$ npm install

Was installed and configured the eslint and prettier to keep the code clean and patterned.

Configuring

Configure your environment variables and remember to start the API before to start this app.

.env

In this file you may configure the API's url. Rename the .env.example in the root directory to .env then just update with your settings.

key description default
REACT_APP_API_URL API's url http://localhost:3333

API

Start the API (see its README for more information). In case of any change in the API's port or host remember to update the .env too.

Usage

To start the app run:

$ yarn start

Or:

npm run start

localStorage

The project saves users's data and token into localStorage keys: @GoBarber:user and @GoBarber:token. Before use @GoBarber:user data you need parse the data to a JavaScript object with JSON.parse function. Below you can see fictitious data:

  • @GoBarber:user
{
  "id": "01931fee-32d4-4af7-b4e9-12159c5d703e",
  "name": "John Doe",
  "email": "johndoe@example.com",
  "avatar": "52bde824dff12071c7df-20200219_214816.jpg",
  "created_at": "2020-06-07T21:16:15.754Z",
  "updated_at": "2020-11-20T04:06:15.975Z",
  "avatar_url": "http://127.0.0.1:3333/uploads/52bde824dff12071c7df-20200219_214816.jpg"
}
  • @GoBarber:token
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MDU4MzQ4MDcsImV4cCI6MTYwNTkyMTIwNywic3ViIjoiMDE5MzFmZWUtMzJkNC00YWY3LWI0ZTktMTIxNTljNWQ3MDNlIn0.uzMK3TufipdyIrKxqakOhJtNF3VH7zkHPAfjTUae2q8

Running the tests

Jest was the choice to test the app, to run:

$ yarn test

Or:

$ npm run test

Coverage Report

You can see the coverage report inside tests/coverage. They are automatically created after the tests run.