Skip to content

Server side of the library for sending content to TSV on git.door43

Notifications You must be signed in to change notification settings

texttree/tsv-send-backend

Repository files navigation

tsv-send-backend

This is the server side of the component responsible for sending data to the git.door43.org.

This component works together with user-notes-rcl.

Deploy to Heroku

Configure .env

Local install

After configuration, you will be presented with a page for checking the server's health. You can send a request from it and make sure that everything works as it should.

After you make sure that everything works correctly, it is better to hide this code in production.

In the .env file, set HIDE_TEST_PAGE=TRUE.


The server has only one entry point. POST request for /send. The input takes an object {resource, bookId, reference, type, fields}.

  • resource - the name of the resource. The created or edited file will be placed in a specific directory. If you do not specify then the directory will not be created.
  • type - file type, 2 or 3 letters, for example, tn, tq, twl, err
  • bookId - is a three-letter book identifier
  • reference - a link in the format chapter:verse
  • fields - an object consisting of fields, like the column names in the file

The TSV file will be located at /<resource>/<BOOKID>_<type>.tsv, for example /ult/GEN_err.tsv If resource = '' is specified, then the file will be located here: /GEN_err.tsv

The server only validates the fields field.

If the file does not exist, then it will be created, if the variable CREATE_FILES=TRUE is set to .env.

According to the specification, the first three columns will be reserved names Reference | ID | Tags. The following will be created with names from object keys.

For example, if there is such an object {Quote: 'test', Note: 'some text'} in the fields, then as a result we will get the following file:

Reference ID Tags Quote Note
1:1 Wer4 test some text

Please note that the keys in the object must have exactly the same name as the columns in the table (Note, not note or NOTE).

About

Server side of the library for sending content to TSV on git.door43

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published