This server is used to record and retrieve Vr data from various Virtual Reality applications and support for VR Dashboard app.
The server supports multi-organization.
The server application is written in Node.js using typescript and express.js.
MongoDb version 6.0 is used as the database.
/.platform
Specific settings for AWS elastic Beanstalk/docs
Generated JsDoc documentation/src
Project source folder/app
Application logic/bootstrap
Defining different types of server/configs
Setting env variables and all global variables/models
Defined global models/server
Express.js server settings/shared
Global files such as enums, repositories, controllers, middlewares, etc./exceptions
Custom Exceptions/repositories
Connection with database/utils
Global Utils
/swagger
Definition of swaggerindex.ts
Application executable file
- MongoDB database with minimal 6 version
- Installed Node.js (minimal v18) and npm
- How to install Node.js: How to install Node.js.
- npm is installed together with Node.js
- Check if Node.js and npm is installed?
- Run
node -v
- Run
npm -v
- Run
To run the application on the local machine for the first time, you need to do the following:
- Run
npm install
- Create an .env file in the project root folder.
- Define the following env in the .env file
- DB_URL
- MONGO_DB_DATABASE
- Generate JS documentation by
npm run generate:docs
- Run the application using
npm run dev
After that, the application should be available at http://localhost:8000.
If you try opening the following address in a browser, you should see the Swagger documentation.
You can find out if the application is connected to the DB by using the address: http://localhost:8000/health-check where you should see message: vr_dashboard_be is running on version: $app_version
.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:8000/health-check to view it in the browser if server is running well.
Builds the app for production to the /build
folder.
Builds the docs to the /docs
folder.
Builds the app for production and zip it into deploy-code.zip
.
This command is for unix system. Or you need to have installed cp command!!
Builds the app for production with setting for AWS ElasticBeanstalk and zip it into deploy-code.zip
.
Api swagger is available on route: /api/docs
Js docs are available on route: /docs
Environment variables are defined in the /src/configs
folder
- APP_MODE: Define in which mode application is running.
- REQUIRED
- VALUES:
LOCALHOST
,PRODUCTION
- SERVER_TYPE: defines the server type
- DEFAULT:
DEFAULT
- DEFAULT:
- PORT: Port on which the application listens.
- DEFAULT:
8080
- DEFAULT:
- WORKERS: Number of running worker threads.
- DEFAULT:
1
- DEFAULT:
- DB_URL: Connection string to mongoDb database.
- REQUIRED
- FORMAT:
mongodb+srv://user:password@host
- MONGO_DB_TYPE: MongoDb database type.
- DEFAULT:
MONGODB
- DEFAULT:
- MONGO_DB_DATABASE: Name of the mongoDb database.
- REQUIRED