Skip to content

Latest commit

 

History

History
62 lines (52 loc) · 1.69 KB

README.md

File metadata and controls

62 lines (52 loc) · 1.69 KB

NodeJS MySQL

This application is developed with NodeJs and MYSQL where express and sequelize are used respectively to aid development. There are 4 API routes defined which demostrates the interactions between the server and database. The APIs only provide the Create, Read and Update functionalities.

Prerequisites

Refer to the setup guide here to install the necessary software tools.

Configuration

These changes apply to /server/config/development.js which can be found here.

Server connection

Set yout preferred IP address and port number for the server.

  domain_name: "http://localhost:3000",
  HOSTNAME: '127.0.0.1',
  PORT: 3000,

MYSQL DB connection

Set your MYSQL DB connection parameters.

  MYSQL_USERNAME: 'root', // Enter your MYSQL DB username
  MYSQL_PASSWORD: 'password', // Enter your MYSQL DB password
  MYSQL_HOSTNAME: 'localhost', // Enter your MYSQL DB hostname
  MYSQL_DATABASE: 'school', // Enter your MYSQL DB database
  MYSQL_PORT: 3306, // Enter your MYSQL DB port number

MYSQL logging

To enable MYSQL statement logging.

  MYSQL_LOGGING: true,

Database initialisation

To drop and create the necessary tables.

  INIT: true,

To create pseudo table records.

  SEED: true,

Launching the application

Install the necessary NPM packages

$ npm i

Start the application

$ npm run start:dev

Unit tests

Ensure that the SEED has been loaded before running the unit tests.

To execute unit tests.

$ npm test

For more information on generating additional test cases, click here.