Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tomaskraus/my-rossum-app

A simple app that uses the Rossum API
https://github.com/tomaskraus/my-rossum-app

Last synced: 24 days ago
JSON representation

A simple app that uses the Rossum API

Awesome Lists containing this project

README

        

# my-rossum-app
A simple app that uses the Rossum API

## Purpose

Part of Node.js developer hiring process is a requirement to create a simple web app that uses the Rossum API.

The task description can be found [here](https://docs.google.com/document/d/1qIeffRqRqgc4kvGC0XvwfA-t_qtGAGXsxxGAjFMv7oU)

__Note__: I simplified the app, so that it responses with a transformed XML. The app also doesn't send that transformed XML elsewhere.

## My approach

- keep it simple, yet organized
- use linter, formatter & follow naming conventions
- use github-flow, pull-requests & link with issues
- involve a bit of functional programming

## My solution

### API

#### endpoint:

/export/{queue_id}/annotations/{annotation_id}

where:
- queue_id is a quue identifier
- annotation_id is an annotation identifier

#### method:

GET

#### response body:
success:
```xml
1434537752019-03-01T00:00:002019-03-31T00:00:0012978.81 ...
```
failure:
```json
{
"success": false,
"message": "failure description"
}
```

__Note__: there will be only "succes" field in the production app release:

```json
{
"success": true,
}
```

#### response status codes:

Those are my-rossum-app driven response status codes:

- 200: Inputs are ok and my-rossum-app works well.\
However, a rossum-service can return a non-success code, for whatever reason. If so, in the response body json, the "success" fields is set to "false", and the "message" json field contains a brief description of the failure.
- 401: user is not authenticated to view the content

### Application first-time setup

read the `env.template` file for further instructions.

### Run

```bash
npm start
```

### Test

Run unit tests:
```bash
npm test
```

To run functional tests, do the following:

1. Ensure the app is running.

2. Run functional tests:
```bash
npm run functional-test
```

## References

- https://githubflow.github.io/
- https://blog.logrocket.com/organizing-express-js-project-structure-better-productivity/
- https://stackoverflow.com/questions/4024271/rest-api-best-practices-where-to-put-parameters
- https://blog.appsignal.com/2021/09/01/best-practices-for-logging-in-nodejs.html
- https://stackoverflow.com/questions/38821947/how-does-a-node-js-server-compare-with-nginx-or-apache-servers