聊天室

vue + socket.io + express + mongodb


后端接口

<p><strong>简要描述:</strong> </p> <ul> <li>用户登录接口</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>/api/login</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>get</li> </ul> <p><strong>参数:</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">必选</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">username</td> <td style="text-align: left;">是</td> <td style="text-align: left;">string</td> <td>用户名</td> </tr> </tbody> </table> <p><strong>返回成功示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;success&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;200&amp;quot;, }</code></pre> <p><strong>返回失败示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;username is required&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;201&amp;quot;, }</code></pre> <p><strong>返回参数说明</strong> </p> <ul> <li> <p>无</p> <p><strong>备注</strong> </p> </li> </ul> <ul> <li>更多返回错误代码请看首页的错误代码描述</li> </ul> <hr /> <p><strong>简要描述:</strong> </p> <ul> <li>用户退出登录接口</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>/api/logout</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>get</li> </ul> <p><strong>参数:</strong> </p> <p>无</p> <p><strong>返回成功示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;success&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;200&amp;quot;, }</code></pre> <p><strong>返回失败示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;log out error,you are not logged in&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;202&amp;quot;, }</code></pre> <p><strong>备注</strong> </p> <ul> <li>更多返回错误代码请看首页的错误代码描述</li> </ul> <hr /> <p><strong>简要描述:</strong> </p> <ul> <li>获取其他人信息</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>/api/others</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>get</li> </ul> <p><strong>参数:</strong> </p> <ul> <li> <p>无</p> <p><strong>返回成功示例</strong></p> </li> </ul> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;success&amp;quot;, &amp;quot;code&amp;quot;: '200', &amp;quot;data&amp;quot;: [ { &amp;quot;username&amp;quot;: &amp;quot;blue&amp;quot;, &amp;quot;sessionId&amp;quot;: &amp;quot;fsdafcxfafadsf&amp;quot;, }, { &amp;quot;username&amp;quot;: &amp;quot;test1&amp;quot;, &amp;quot;sessionId&amp;quot;: &amp;quot;fsdaffdsfaadsfafadsf&amp;quot;, }, { &amp;quot;username&amp;quot;: &amp;quot;test23&amp;quot;, &amp;quot;sessionId&amp;quot;: &amp;quot;fsdafcxfafafsdfaddsf&amp;quot;, }, ] }</code></pre> <p><strong>返回失败示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;get others error&amp;quot;, &amp;quot;code&amp;quot;: '203', }</code></pre> <p><strong>返回参数说明</strong> </p> <table> <thead> <tr> <th style="text-align: left;">参数名</th> <th style="text-align: left;">类型</th> <th>说明</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">sessionId</td> <td style="text-align: left;">string</td> <td>sessionId是用户在后端生成的一个session id,存放在mongodb里</td> </tr> </tbody> </table> <p><strong>备注</strong> </p> <ul> <li>更多返回错误代码请看首页的错误代码描述</li> </ul> <hr /> <p><strong>简要描述:</strong> </p> <ul> <li>获取其他人信息</li> </ul> <p><strong>请求URL:</strong> </p> <ul> <li><code>/api/testlogin</code></li> </ul> <p><strong>请求方式:</strong></p> <ul> <li>get</li> </ul> <p><strong>参数:</strong> </p> <ul> <li> <p>无</p> <p><strong>返回成功示例</strong></p> </li> </ul> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;success&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;200&amp;quot;, &amp;quot;username&amp;quot;: &amp;quot;blue&amp;quot; }</code></pre> <p><strong>返回失败示例</strong></p> <pre><code> { &amp;quot;msg&amp;quot;: &amp;quot;not log in&amp;quot;, &amp;quot;code&amp;quot;: &amp;quot;204&amp;quot;, }</code></pre> <p><strong>返回参数说明</strong> </p> <ul> <li> <p>无</p> <p><strong>备注</strong> </p> </li> <li>更多返回错误代码请看首页的错误代码描述</li> </ul>

页面列表

ITEM_HTML