Giter Site home page Giter Site logo

clock-in-out-system's Introduction

Clock In Out System

System for employees to clock in / out with query functions.

API Documentation

Please see https://fhmclockinsys.docs.apiary.io/

Postman

Postman Collection is prepared and stored in /postman. Import the folder to Postman to start calling API.
An environment Local Dev is created to call localhost server. Change the server_url to a suitable one or create a new environment.

Deployment Documentation

.env File

A .env file at root directory is always necessary for this system to run regardless of envrionment.
Before deployment, prepare the .env file with following parameters or check .env.template.

# == Database ==
MYSQL_HOST=
MYSQL_PORT=
MYSQL_DB_NAME=
MYSQL_USER=
MYSQL_PASSWORD=
# Path to JSON file containing data to be inserted in DB when startup, e.g. ./data/member.json. Can be empty
DEFAULT_FILE_PATH=

# == API ==
# Port number that the server is listening to
SERVER_PORT=
# For api versioning and will affect the URL that server is listening, /api/{API_VERSION}/xxx
API_VERSION=

Docker

Docker Compose is used to start a MySQL DB together with this system.

  1. Change the database password to a strong one in docker-compose.yml for security reason.

    environment:
       - TZ=Asia/Taipei
       - MYSQL_DATABASE=c
       - MYSQL_USER=sys_admin
       - MYSQL_PASSWORD=[CHANGE TO STRONG PASSWORD]
       - MYSQL_ROOT_PASSWORD=[CHANGE TO STRONG PASSWORD]
    
  2. Create the .env file as mentioned.

    • Suffix can be added to identified in which environment this file is used. For example, name it .env.docker
    • Remember to change MYSQL_PASSWORD to the one used in step 1.
  3. Update the env_file in docker-compose.yml to the filename of the .env file created. Default is .env.docker.

  4. Run the containers by

    docker-compose up -d
    
  5. May need to wait for several minutes for the MySQL server to start and the system to connect to it.

  6. Server should be listening to port 3000 and waiting for incoming calls.

Local Run

  1. Prepare a MySQL Server, with database created. For example,

    CREATE DATABASE clock_in_out_system;
    
  2. Create the .env file as mentioned.

  3. Run the npm commands

    npm install
    npm run start
    
  4. Server should be listening to port 3000 and waiting for incoming calls.

clock-in-out-system's People

Contributors

fung-hei-man avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.