# Trampa API Frontend

Welcome to frontend application for trampa website. In next sections we will walk you through our project, setting it up on your computer, building it for production and last but not the least walk you through tools that we used:

- [Description](#Description)
- [Setup](#Setup)
- [Testing](#Testing)

# Description
This is an internal project for e-commerce website called Trampa that was done by Diligent.
Our project is hosted on our local [git](https://git.dilig.net/selenaaasi/trampa-frontend) 

## Tech stack

In this project we used Node and N(ode)P(ackage)M(anager) for initializing project
and importing a lot of libraries that helps us developing.

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Every HTTP request is implemented via Axios, and for handling asynchronous code we used Saga.

## Node Package Manager

In order to run this project you need to install Node that comes with its Package Manager.
Please follow the official tutorial on installing Node which can be found on this link:
> https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

## Development environment
- [Visual Studio Code](https://code.visualstudio.com/Download) - Used as the primary code editor
- [npm](https://www.npmjs.com/) - Used for installing node and running our application
- [git](https://git-scm.com/downloads)

# Setup

Here we will show you how to set up project and run it in localhost.
## Project setup
In order to run our project you need to clone it from [git](https://git.dilig.net/selenaaasi/trampa-frontend.git) first. Open terminal (cmd and powershell work as well) in folder that you want this project to be and run command 
> git clone http://git.dilig.net/selenaaasi/trampa-frontend.git

After cloning project you can open it with your preferred IDE/Code editor if you want to see the code. Before running project you need to open terminal and run command 
> npm install

Running that command will download all necessary npm packages to run the project. 

Now your project is ready for setup on both local and production environment.

### Local project setup

You can run the project using
> npm start

Congratulations! You now run website application on following website:
> http://localhost:3000/

### Production project setup

You can make the production build using
> npm run build

Congratulations! You now have production build which is ready for deploy!
The build is minified and the filenames include the hashes.
It correctly bundles React in production mode and optimizes the build for the best performance.

When your application is deployed you can run it using:
> npx serve -s build

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

# Testing
Here we will show you how to run tests and see code coverage

## Testing framework
We needed to write tests, unit, integration and E2E. Framework that we used for that is called [jest](https://www.npmjs.com/package/jest).

When we write our tests we can use following comand: 
> npm test

which launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.



