mapping string to int
This commit is contained in:
@@ -15,15 +15,17 @@ server.on('message', async (msg, rinfo) => {
|
||||
console.log(`Server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
|
||||
|
||||
const strMsg = msg.toString()
|
||||
const categories = await app(strMsg)
|
||||
let categories = await app(strMsg)
|
||||
|
||||
let result = {}
|
||||
|
||||
categories = categories.map(category => parseInt(category))
|
||||
|
||||
if (categories)
|
||||
result = {
|
||||
result: categories
|
||||
}
|
||||
|
||||
console.log(result)
|
||||
server.send(JSON.stringify(result), rinfo.port, rinfo.address, (err) => {
|
||||
if (err) server.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user