An application to randomly display a quote. The NestJs server uses an in-memory sqlite database.
This project is split into 3 separate packages:
.
├── packages
│ ├── client # ReactJs application
│ ├── domain # TypeScript library
│ ├── server # NestJs api application
- Node v16
npm install npm@latest -g
To install the dependencies and run the scripts it is recommended to use yarn
npm install --global yarn
-
Clone the repo
git clone https://github.com/barryajones/violet-labs.git
-
Install packages
yarn
-
Build the domain library
yarn build:domain
This will build the domain library which contains a shared interface used in the
server
andclient
apps.
To run the application you need will need to start the api server and client application.
Open a terminal window and run the following command from the root of the project:
yarn start:server
This will start the NestJs application and seed the in-memory sqlite database with data from office_quotes.json.
You can access the api from your browser or with postman at the following address http://localhost:3000/quote. Alternatively open a terminal window and use cURL
curl 'http://localhost:3000/quote' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9'
curl 'http://localhost:3000/quote?characters=Jim,Pam' \
-H 'Accept: */*' \
-H 'Accept-Language: en-US,en;q=0.9'
Open another terminal window to start the client application.
yarn start:client
This will run the app in the development mode. Open http://localhost:4000 to view it in the browser. To display a different quote press the Random Quote button.
cd packages/server && yarn test
cd packages/server && yarn test:e2e