BLOOD TEST DIARY
Requirements
For development, you will only need Node.js and npm installed on your environment.
Node and npm
Node is really easy to install & now include npm. You should be able to run the following command after the installation procedure below.
$ node --version
v11.6.0
$ npm --version
6.7.0
Node installation on OS X
You will need to use a Terminal. On OS X, you can find the default terminal in
/Applications/Utilities/Terminal.app
.
Please install Homebrew if it's not already done with the following command.
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
If everything when fine, you should run
$ brew install node
Node installation on Linux
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs
Node installation on Windows
Just go on official Node.js website & grab the installer.
Also, be sure to have git
available in your PATH, npm
might need it.
How to use code quality and testing tools
ESLint:
Currently only used for node backend support
To check path/to/app.js
:
$ npm run -s eslint path/to/app.js
It is advised to install editor extensions which will allow to check for errors automatically. VSCode: vscode-eslint Atom: linter-eslint
Mocha, Chai, and Instanbul
To recursively run tests in server/
:
$ cd server
$ npm test
To recursively run tests in client/
$ cd client
$ npm test
Configure app
Server connection
The configuration file is client/config/app_config.json
port
: the port on which the local app runs
staticFolder
: the static folder containing the frontend app
indexFile
: the index.html file which is served when the app receives get requests
{
"port" : 4200,
"staticFolder" : "/public",
"indexFile" : "index.html"
}
Email sender
The configuration file is server/config/email_config.json
{
"transporter": {
"host": "smtp.mail.yahoo.com",
"port": 465,
"service": "yahoo",
"secure": false,
"auth": {
"user": "example@yahoo.com",
"pass": "password"
},
"logger": true
}
/.../
}
for info on usage and possible additional settings, go to nodemailer.com
Instructions for running
To run the application follow these steps:
- First a database needs to be set up. For this use
schema.sql
andinsert.sql
files inserver/database/
folder. - You might have to configure some files in
server/config/
folder. - Then go to
server/
folder and first runnpm install
command. Then runnpm start
. The server is now running. - Now you have two options for running the application. You can simply run the .exe file provided in
builds/
folder and continue from step 7. - Another option is running it in development mode. Go to
client/
folder and runnpm i
. - Then run
npm run electron-dev
. - The application is now running. If the application does not automatically connect to the server, you can update the IP and port in the top right corner.
Languages & tools
- NodeJS is used for the back-end.
- React is used for UI
- Electron is used for deploying the desktop app
- ESLint is used for linting support
- Mocha is used for testing
- Chai is used for assertions
- Instanbul is used for test branch coverage checks
- nodemailer is used for sending emails
- mysql for managing and creating a relational database
- mocha-sinon used for integration between mocha and sinon, allowing for automatic cleanup of spies
- proxyquire used to proxy nodejs's require in order to make overriding dependencies
- [mjml] (https://mjml.io/) used for email formatting