The Backend Service is responsible for processing dataset query operations, including spatial and non-spatial tasks such as bounding box operations, spatial joins, road information tagging, and dataset unions. This service ensures that the required dataset manipulations are performed efficiently, and it returns OSW-compliant datasets as output, enabling seamless integration with TDEI system components.
The project is built on NodeJS framework. All the regular nuances for a NodeJS project are valid for this.
| Software | Version |
|---|---|
| NodeJS | 16.17.0 |
| Typescript | 4.8.2 |
Application configuration is read from .env file. Below are the list of environemnt variables service is dependent on. An example of environment file is available here and description of environment variable is presented in below table
| Name | Description |
|---|---|
| PROVIDER | Provider for cloud service or local (optional) |
| QUEUECONNECTION | Queue connection string |
| STORAGECONNECTION | Storage connection string |
| PORT | Port on which application will run |
| AUTH_HOST | TDEI Auth service url |
| POSTGRES_DB | Database name |
| POSTGRES_HOST | Link to the database host |
| POSTGRES_USER | Database user |
| POSTGRES_PASSWORD | Database user password |
| SSL | Database ssl flag |
| OSW_SCHEMA_URL | OSW Schema Url |
| BACKEND_RESPONSE_TOPIC | Response topic on which result to be announced |
Follow the steps to install the node packages required for both building and running the application
- Install the dependencies. Run the following command in terminal on the same directory level as
package.jsonnpm install
- To start the server, use the command
npm run start - The http server by default starts with 3000 port or whatever is declared in
process.env.PORT(look atindex.tsfor more details) - Health check available at path
health/pingwith get and post. Makegetorpostrequest tohttp://localhost:3000/health/ping. Ping should respond with "healthy!" message with HTTP 200 status code.
Follow the steps to install the node packages required for testing the application
- Ensure we have installed the dependencies. Run the following command in terminal on the same directory level as
package.jsonnpm install
- To start testing suits, use the command
npm test, this command will execute all the unit test suites defined for application.
Service request signatures are defined under Service signatures
Subscriptions to listening topics are configured in the /src/subscription.json file. This file defines the topics that the system listens to for incoming messages.
{
"messageId": "job_id",
"messageType": "workflow_identifier",
"data": {
"service" : "bbox_intersect",
"parameters": {
"tdei_dataset_id" : "tdei_dataset_id",
"bbox" : [1,2,3,4]
},
"user_id": "user_id",
}
}{
"messageId": "job_id",
"messageType": "workflow_identifier",
"data": {
"service" : "file path",
"parameters":{...},
"file_upload_path" : "zip file path",
"success": true|false,
"message": "message" // if false the error string else empty string
}
}