Express.js is a Node.js web application framework which by providing a set of web application features allows developers to easily build APIs and, hence, web applications (backend)
Sqlite is a C-language library that implements a small and self-contained SQL database engine. Sqlite3 is the latest version of Sqlite. Sqlite is local, meaning that the the database file (.db
which contains the data) is on the same machine (or environment) that the schema resides. This means that Sqlite is serverless. This property of Sqlite makes it pretty fast. The library used to do CRUD operations is called better-sqlite3. It ia a node
wrapper for Sqlite3 with an emphasis on performance. The primary reason it was chosen over the other wrappers is because of its performance, ease of use, and the seamless integration with TypeScript.
TypeScript is a strongly-typed programming language that builds on JavaScript. TypeScript uses type inference
to figure out types of variables, functions, and return values in different parts of the programme.
ESLint is a code analyzer that statically analyzes code base on the instructions that the developers provide for it in the .eslintrc.json
file. Using this file developers can configure and tailor the behavior of ESLint. ESLint uses the instructions and finds syntax problems, unreachable code, and indentation problems etc.
mqtt is a client library for the MQTT protocol. It is written in JavaScript for Node.js and the browser. For those who do not kno what MQTT is, MQTT is a protocol used in the publish subscribe architectural style for components to communicate with each other. It makes use of a Message bus, usually called the broker to communicate the message with other components.
Install dependencies with:
$ npm install
.eslintrc.js
: linter configuration file..env
: local environment variables to overwrite default configuration options..env.sample
: sample environment variables to be used as a template for.env
.app.ts
: the entry point of the service.tsconfig.json
: TypeScript configuration file.package.json
- Dependencies, script definitions for Node.js.config/
: configuration files for the service.db/
: database connection, configuration and schema definitions.controllers/
: communication middleware between the service and other components of the system.routes/
: routing definitions based on the middleware of the service.public/
: static files for the service.dist/
: the build folder for the service.
In the services/<SERVICE_NAME>
subdirectory, you can run:
Runs the current service in the development mode, in port 3005
and localhost
by default.
Builds the server-side application for production to the dist
folder.
Runs the server-side application in the production mode, based on the dist
folder.
Runs the linter on the server
folder.
Drops all the tables from the current service. In other words, this command removes all data from the current service.
Runs the linter on the server
folder and fixes the errors.
The system currently operates on the local level, and any deployment instructions shall be documented here in the future.