Select Git revision
-
Ole Christian Eidheim authoredOle Christian Eidheim authored
README.md 1.18 KiB
Client tests example
Setup database connections
You need to create two configuration files that will contain the database connection details. These
files should not be uploaded to your git repository, and they have therefore been added to
.gitignore
. The connection details may vary, but example content of the two configuration files
are as follows:
server/config.ts
:
process.env.MYSQL_HOST = 'mysql.stud.ntnu.no';
process.env.MYSQL_USER = 'username_todo';
process.env.MYSQL_PASSWORD = 'username_todo';
process.env.MYSQL_DATABASE = 'username_todo_dev';
server/test/config.ts
:
process.env.MYSQL_HOST = 'mysql.stud.ntnu.no';
process.env.MYSQL_USER = 'username_todo';
process.env.MYSQL_PASSWORD = 'username_todo';
process.env.MYSQL_DATABASE = 'username_todo_test';
These environment variables will be used in the server/src/mysql-pool.ts
file.
Start server
Install dependencies and start server:
cd server
npm install
npm start
Run server tests:
npm test
Bundle client files to be served through server
Install dependencies and bundle client files:
cd client
npm install
npm start
Run client tests:
npm test