Tag-Based Message Formatting

Përfunduar Postuar 5 vite mё parё Paguhet në dorëzim
Përfunduar Paguhet në dorëzim

It is mandatory to have Node.js code.

Consider a JSON object that contains the following structure and values:

{

"context": {

"language": "FR",

"channel": "WEB"

},

"output": [

"ansCode": "BS_ANS_100",

"otherdata": "othervalue"

],

"user": {

"name": "Bobby",

"lastName": "Sponge",

"age": "2",

"balance": "$59.34"

}

}

Consider an existing Database (MySQL) that contains the following table:

TABLE Answer (

Answer_UID int PK

Code string

Language string

Channel string

Text string)

That contains the following value as example:

(100,

“BS_ANS_100”,

“EN”,

“WEB”,

“Hello dear <? [login to view URL] > <? [login to view URL] >, your balance is <? [login to view URL] >.”)

We are looking for a Node.js function that:

- Get the JSON object “[login to view URL]” value;

- That fetch from the Database all records that match the value of the “[login to view URL]” for the given ‘[login to view URL]’ and ‘[login to view URL]’ defined in the JSON object.

o If there are multiple records that are returned, a random record must be selected.

o If there is no match in the DB because there is no DB entry for ‘Channel’, the record that match ‘Code’ and ‘Language’ must be returned.

o If there is no match in the DB because there is no DB entry for ‘Language’, the record that match ‘Code’ and ‘Channel’ must be returned.

o If there is no match in the DB because there is no DB entry for ‘Language’ and ‘Channel’, the record that match ‘Code’ must be returned.

o If there is no match in the DB because there is no DB entry for ‘Code’, an error must be returned.

- Extract the ‘Text’ string from the record of the DB

- Calls an existing function to replace in ‘Text’ each tag (delimited by the ‘<?’ and the ‘>’) by their corresponding value in the JSON object.

o The result of the above example will give: “Hello dear Bobby Sponge, your balance is $59.34.”. The tag “<? [login to view URL] >” has been replace by the JSON value of the key “[login to view URL]”. This replacement function exists and is currently working.

o BUT on top of this, we are looking for Formatting capabilities.

o If the Tag contains the word ‘Format’ then formatting must be applied. As example if Text = “Your balance is <? Format(‘# ##0.00 $’, [login to view URL]) >.” Then the function should return the string: “Your balance is 59.34 $.”

o The formats for Currencies and Date must be supported, like “HH:mm:ss”, “DD/MM/YY” or “YYYY-MM-DD hh:mm:ss” etc.

o We may think adding additional format in the future, but not many, therefore the formatting string ("HH:mm:ss" as example) must be flexible.

Consider also that "Format" is our initial function that does formatting of text. We must be able to replace Format by some other capability. Here is an exemple:

- Assume Text = “The weather for today is <? [login to view URL]('today', 'New York', 'temperature') >.”

- The function should recognise that it is not Format but [login to view URL] and calla sub-function to get the weather for 'New York' for 'today' and 'temperature'. The number of parameter can depend. And the variable of the API must depend on the '[login to view URL]' value in the JSON object.

- The result should be “The weather for today is 75F."

We are looking for someone who can develop that Node.js function that takes as input parameter the JSON object and return a formatted string as described above. The function must perform the call into the DB and manage the errors as described above.

Additionally the code must be flexible enough to manage different keywords like "[login to view URL]" and not just "Format".

JavaScript JSON MySQL Node.js

ID Projekti: #17450260

Rreth projektit

10 propozimet Projekti në distancë Aktiv 5 vite mё parё

Është zgjedhur fitues:

imRaziel

hi. i can do it. please send your code that does replacing values from json .

€100 EUR për 3 ditë
(16 Përshtypje)
4.5

10 profesionistë freelancer dërguan një ofertë mesatare prej €171 për këtë punë

pointlogic

Hello, I am expert working on Node.js, I always provide fastest results with quality. I have an experience of more than 10 years in web development and maintenance. I have in-depth knowledge of php, mysql, javascript , Më shumë

€194 EUR për 7 ditë
(63 Përshtypje)
6.9
mxicoders

Dear Sir, Greeting from my side, Please accept my proposal for the job of Tag-Based Message Formatting I would like to apply for this project, and I will make it as per your requirement, as described in your Job Më shumë

€250 EUR për 21 ditë
(12 Përshtypje)
6.2
liangjongai

Hello! We are interesting your project very well and full time devlopers. We have great skill in Node.js and javascript. Our price and period is negotiable. Employee’s satisfy is my happiness ! Let's go ahead w Më shumë

€200 EUR për 31 ditë
(71 Përshtypje)
6.2
oklaspec

Good day! Nice to meet you. Thank you for sharing this proposal. I am an expert just what you need for nodejs task with much years expirience. Want more real examples like sql or microservice? - just ask. Check Më shumë

€250 EUR për 5 ditë
(12 Përshtypje)
5.3
billinhit

Hi, I am a fullstack developer. I am strong on nodejs/expressjs/mogodb/MySQL. I read your requirements, i am clear what i should do. I can handle this project easily, I confident of completing this project on time. Më shumë

€60 EUR për 5 ditë
(0 Përshtypje)
0.0
techvinod

Hi, Thank you for giving me a chance to bid on your project. i am a serious bidder here and i have already worked on a similar project before and can deliver as u have mentioned I have got Rich experience in Jooml Më shumë

€155 EUR për 3 ditë
(0 Përshtypje)
0.0