Skip to content

Latest commit

 

History

History
75 lines (60 loc) · 2.34 KB

README.md

File metadata and controls

75 lines (60 loc) · 2.34 KB

Getting Started - NodeJS Kiosk-API Server & Init Database

This guide provides step-by-step instructions for setting up and running the kiosk server and database as part of the signage solution project. Follow these steps to ensure the server is configured and operational.

Prerequisites

Before getting started, make sure you have the following software installed on your system

  • Node.js: Make sure you have Node.js installed. You can download it here.
  • MySQL 8.0: Ensure that MySQL version 8.0 is installed on your machine. You can find the installation instructions here.

Basic Setup

  1. Navigate to the NODEJS Directory:

    cd signage_solution/nodejs
  2. Install npm Modules:

    npm install
  3. Create a .env file in the nodejs project's root directory and configure the database connection information, admin password, and port number. Here is an example of what the contents of the .env file might look like:

    touch .env

    example of .env content:

    DATABASE_URL="mysql://<database username e.g. root>:<database password e.g. pass@word>@<database host e.g. localhost>:3306/<database name e.g. kioskDB>"
    PORT=4000(the number what you want to change)
  4. To create a database, open MySQL Shell and start your MySQL server:

    mysql -u root -p

    and

    CREATE DATABASE <database name> e.g. kioskDB;

    If successful, stop your MySQL server by execute the following command:

    quit
  5. Execute the migration to create database tables in mysql database:

    npx prisma migrate dev
  6. Generate dummy data for testing using the following command:

    npm run seed

    If successful, the following message will be displayed:

    Connected
    Success
    

    After successfully generating dummy data using the npm run seed command, you may need to terminate the seed command to proceed with other tasks or steps. press Ctrl + C.

  7. To run the program, use the following command:

    npm run start

    If successful, you should see a message similar to the following:

    Server is running on port {port number (default port number is 4000)}.
    Connected