简体   繁体   English

我如何像在JSFiddle中那样创建唯一的会话ID?

[英]How can I create a unique session ID like in JSFiddle?

I would like to create a unique session url for each connection on my website like on JSFiddle 我想为网站上的每个连接创建一个唯一的会话URL,例如在JSFiddle上

I'm using NodeJS and Express . 我正在使用NodeJSExpress

The result should be as follow: 结果应如下:

for members: 对于成员:

https://mywebsite.com/user/uniqueID/
*eg : https://mywebsite.com/user/o2gxgz9r/*

for guests: 对于客人:

https://mywebsite.com/uniqueID/
eg : *https://mywebsite.com/k36yot0z/*

How can I achieve that and is there any specific frameworks for this kind of job? 我该如何实现这一目标,并且针对这种工作有任何特定的框架吗?

有许多用于生成随机id的库,仅举几例:nid,uuid, hyperid ,hashid,shortid等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM