Following application is a simple form which lets user register with first name, last name, email and event date. Application has been deployed on Heroku https://brainhub-registration.herokuapp.com.
Server
- NodeJS
- Typescript
- Express
- PostgreSQL
- Knex
- Jest
- Supertest
Client
- React
- Typescript
- React Router Dom
- React Testing Library
Create .env file in server folder, following environment variables must be provided:
PGUSER=USER_NAME
PGHOST=DB_HOST
PGPASSWORD=DB_PASSWORD
PGDATABASE=DB_NAME
PGPORT=DB_PORTIt is possible to run application locally on two ways:
- Head to server folder
cd server- Build client application
yarn build:client- Start server
yarn start:dev- Head to server folder
cd server- Install dependencies
yarn install- Start server
yarn start:dev- Go back to the project root and head to client folder
cd ..cd client- Install dependencies
yarn install- Start application
yarn startIn order to run tests, head to server or client folder and run:
yarn testAs a POC, I've also added sample cypress tests (it's just an example which I believe shows the flow of tests not a full coverage). In order to run cypress tests run following commands:
- Install dependencies
yarn install- Build client
cd serveryarn run build:client- Build server
yarn run build- Start server - Knex configuration is set to connect to sqlite database in memory
yarn start:cypress- Start cypress server - it will open Cypress dashboard where you can manage tests and see the results
yarn run cypres:open- POST
api/users
Allows to register user.
Parameters:
firstNamelastNameemaileventDate
- GET
api/usersReturns an array of all users.
- Route with a list of users should be created on client side, based on data returned from
api/usersget endpoint. - More e2e cypress tests should be written to provide stability.
- Github workflows should be added (install/build/unit tests/cypress tests).