Nodejs generate short unique alphanumeric

前端 未结 6 707
借酒劲吻你
借酒劲吻你 2021-01-30 23:55

I would like to generate a short unique alphanumeric value to be used as confirmation codes for online purchases. I\'ve looking into https://github.com/broofa/node-uuid but the

6条回答
  •  不要未来只要你来
    2021-01-31 00:44

    IF each online purchase associated to Unique URL , you can use the backend of simple-short package,which don't require database connection, nor web services :

    var shorten=require('simple-short');
    
    shorten.conf({length:8}); // Default is 4. 
    
    code1=shorten('http://store.com/purchase1');
    code2=shorten('http://store.com/purchase2');
     //.. so on 
    

提交回复
热议问题