Skip to content

asiaziola/registration-form-react-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Registration form

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.

Technologies

Server

  • NodeJS
  • Typescript
  • Express
  • PostgreSQL
  • Knex
  • Jest
  • Supertest

Client

  • React
  • Typescript
  • React Router Dom
  • React Testing Library

Run locally

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_PORT

It is possible to run application locally on two ways:

Run client application from server

  1. Head to server folder
cd server
  1. Build client application
yarn build:client
  1. Start server
yarn start:dev

Run server and client separately

  1. Head to server folder
cd server
  1. Install dependencies
yarn install
  1. Start server
yarn start:dev
  1. Go back to the project root and head to client folder
cd ..
cd client
  1. Install dependencies
yarn install
  1. Start application
yarn start

Run tests

In order to run tests, head to server or client folder and run:

yarn test

As 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:

  1. Install dependencies
yarn install
  1. Build client
cd server
yarn run build:client
  1. Build server
yarn run build
  1. Start server - Knex configuration is set to connect to sqlite database in memory
yarn start:cypress
  1. Start cypress server - it will open Cypress dashboard where you can manage tests and see the results
yarn run cypres:open

API

User

  1. POST api/users

Allows to register user.

Parameters:

  • firstName
  • lastName
  • email
  • eventDate
  1. GET api/users Returns an array of all users.

Future plans

  1. Route with a list of users should be created on client side, based on data returned from api/users get endpoint.
  2. More e2e cypress tests should be written to provide stability.
  3. Github workflows should be added (install/build/unit tests/cypress tests).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published