@runnerpro/backend
v1.19.5
Published
A collection of common backend functions
Readme
modern-npm-package
An npm packages for common backend logic between client and dashboard app.
Get Started
- Run
npm install @runnerpro/backend
Functions
query
Connection with the PostgresSQL database
- Param: string with PostgreSQL query
- Param: array of values
- Return: promise of array of values (each item is a row of the table)
batchQuery
Connection with PostgreSQL database in batches. Use for faster query execution when we need to execute many queries.
- Param: Array of queries
- query: string with PostgreSQL query
- values: array of values
- Param?: length of promises wait together. Default 5
- Return: promise (without values)
sendMail
Send mail with company logo and template
Param: { subject, title, body, to, link?, attachments?, bcc? }
- subject: title of the mail
- body: text inside card
- to: array of mails. In DEV and SBX the value is taken from .env GMAIL_EMAIL_USER
- link: button to redirect to the app. { text: text inside button, url: path (after runnerpro.com) }
- attachments: array of files to attach. { filename: name and extension of file, path: path of file, cid?: identifier to insert inside the body (
<img src="cid:__cid__" />) } - bcc: array of mails to send via bcc
Return: promise (without values)
sendNotification
Send web or native notification to client: TODO
- Param: Array of queries { query: string with PostgreSQL query, values: array of values }
- Param?: length of promises wait together. Default 5
- Return: promise (without values)
sleep
Wait X miliseconds to execute next line
- Param: number of miliseconds of the promise
- Return: promise (without values)
Deploy new version
- Create a folder with the name of functionality and index.ts inside. Write the function and export it.
- In main index.ts (the one inside src), import and export it
- Change the version number of the package (using this convenction)
- Run
npm login - Run
npm run publish
