Backend repository consists of 2 parts: backend server using Node.js' Express framework & database using MariaDB.
It acts as a middleman between IoT sensors and Frontend application receiving, storing and serving data.
See IoT & Frontend repositories for the other parts of the project.
Node.js 10.16.0 or newer is required. Latest LTS is recommended.
Configure .env
file with database credentials to project root
DB_HOST='localhost'
DB_USER='username'
DB_PASS='password'
DB_NAME='database'
Install dependencies for development enviroment
npm install
Note that in production environment you can do
npm install --only=prod
.
Project uses MariaDB. It is available for most Linux distribution repositories and Windows.
# Arch based
pacman -S mariadb
# Debian based
apt install mariadb-server
Database can be created using this SQL file.
Run the main application server.js
located in project root
node server.js
or
npm start
Run with
npm run build
Or run as PM2 process
pm2 start server.js
Subsequently control pm2 apps by invoking assigned id or name, e.g.
pm2 start 0
No SSL certificate means HTTPS protocol is disabled. If you run into CORS error, make sure your browser doesn't force HTTPS protocol
Base URL
http://206.189.16.14/
Register
http://206:189.16.14/register
Latest status of each room
http://206.189.16.14/getAllRooms
Same in nested format
http://206.189.16.14/getAllRoomsTesting
Several tools have been utilized to improve and sanitize codebase. Dotfiles are included within repository.
Files are being linted with
- ESLint
- Prettier
- sql-lint
- husky
Pre-commit hook is configured to run linting against staged files and prevent faulty commits.
Pushed commits and merge requests are linted using GitHub Super-Linter. See the configuration file linter.yml for details.
- MIT License - Copyright (c) 2021 Popup Meeting Rooms Project