Generic server side script


#1

Hello guys,

I would like to ask you guys about how can I write more generic script which works with all of PUT requests or POST requests.

For example, I want to write the history of all actions of my services to the audit table.

In the server-side scripting, it is possible to write the script code table by table (resource by resource), and I need to have more generic scripting possiblity.

Thank you


#2

Hi, @uurtsaikh201

I think the most generic it could be, would be through the entry points of {table_name} and {table_name}.{id} service by service (diferents databases), and verb by verb (POST, PUT, PATCH, DELETE).

Step 1 (selec {table_name} and {table_name}.{id} events)

Step 2 (selec all verbs of writing) (repeat this step to {table_name}.{id})

Step 3 (write your script) (The queue is optional, but consider to create async audit, if you not interest it, select pre or post process.)

In this example, you need write the same script 8x (one to each verb “4” into {table_name} and {table_name}.{id})

best regards,
Junior Conte


#3

Hello dear,

Thank you.

Do you think this code is generic?

For example, if I have 50 tables, then I would write script 200 times.

Is that correct?

Tom


#4

The {table_name} is alias to all tables, and is apply to all requests.
In my example, all request of POST 1.C.SCRIPT is applied to any requested table of service museum.


#5

Hello Junior Conte,

Thank you.
Your right.