All Projects → bergwhite → nchat

bergwhite / nchat

Licence: other
The third edition of nodejs-chat. Mobile edition with rest api. Support token authentication.

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to nchat

Meantorrent
meanTorrent - MEAN.JS BitTorrent Private Tracker - Full-Stack JavaScript Using MongoDB, Express, AngularJS, and Node.js, A BitTorrent Private Tracker CMS with Multilingual, and IRC announce support, CloudFlare support. Demo at:
Stars: ✭ 438 (+434.15%)
Mutual labels:  gulp, socketio
tux
A baseline toolkit to ease the building of static HTML sites or integrating into templated CMS builds.
Stars: ✭ 34 (-58.54%)
Mutual labels:  gulp
bulletproof-email
A Gulp workflow for maintainable email templates
Stars: ✭ 71 (-13.41%)
Mutual labels:  gulp
beginner-windows-npm-gulp-webdev-tutorial
Beginner guide for users on web development with node.js/npm + gulp terminal commands. You'll learn how to use other terminal commands like git, gulp, bower, yarn, and more!
Stars: ✭ 40 (-51.22%)
Mutual labels:  gulp
gulp-inject-partials
A recursive injection of partials based on their path name. Implementation of specific case of gulp-inject.
Stars: ✭ 26 (-68.29%)
Mutual labels:  gulp
generator-vintage-frontend
Modern front-end workflow
Stars: ✭ 15 (-81.71%)
Mutual labels:  gulp
generator-angular-pro
AngularJS project generator for scalable, enterprise-grade web and mobile applications
Stars: ✭ 43 (-47.56%)
Mutual labels:  gulp
generator-zyy-h5
A lovely H5 template
Stars: ✭ 23 (-71.95%)
Mutual labels:  gulp
gulp-spsync
Gulp plugin for synchronizing local files with a SharePoint library
Stars: ✭ 57 (-30.49%)
Mutual labels:  gulp
bootstrap-5-sass-gulp-4-boilerplate
A Bootstrap 5.0.0 boilerplate with bootstrap-icons, sass and gulp 4
Stars: ✭ 26 (-68.29%)
Mutual labels:  gulp
gulp-yarn
Automatically install node modules using Yarn. 😻
Stars: ✭ 22 (-73.17%)
Mutual labels:  gulp
Anchor-Bootstrap-UI-Kit
Anchor is a free Bootstrap UI Kit with flexible, ready to use UI components which will hep you build websites faster.
Stars: ✭ 69 (-15.85%)
Mutual labels:  gulp
chat-server
A simple chat server using Flask, SocketIO and ReactJS.
Stars: ✭ 15 (-81.71%)
Mutual labels:  socketio
Gulp-Beginners-Guide
Gulp 基本教學 - 從無到有 Gulp-Beginners-Guide
Stars: ✭ 29 (-64.63%)
Mutual labels:  gulp
postcss-font-grabber
A postcss plugin, it grabs remote font files and update your CSS, just like that.
Stars: ✭ 26 (-68.29%)
Mutual labels:  gulp
speedy
Development environment for static pages using Gulp - Pug & Sass & browser-sync & babelify & browserify
Stars: ✭ 13 (-84.15%)
Mutual labels:  gulp
codeplayer
An online judge system for competitive programming platform, The website is hosted on http://codeplayer.co.in
Stars: ✭ 12 (-85.37%)
Mutual labels:  socketio
modest-tsc-ng1-boilerplate
No description or website provided.
Stars: ✭ 36 (-56.1%)
Mutual labels:  gulp
gulp-stylestats
Gulp task for StyleStats.
Stars: ✭ 61 (-25.61%)
Mutual labels:  gulp
generator-yeomify-landing
Yeoman generator for landing project powered by Gulp
Stars: ✭ 29 (-64.63%)
Mutual labels:  gulp

全栈式的开发多人在线聊天室

  • 3.1.0 / 项目已从Session认证改为Token认证,更好的支持跨域用户认证。
  • 3.1.1 / 修复PC页面访问的重定向问题。

技术栈

觉得好的欢迎点个star ^_^。

  • 前端:Express & EJS & ES6 & Less & Gulp
  • 后端:Express & SocketIO & MongoDB & REST API & Token
  • 部署:Linux & PM2

演示

NChat-qrcode

目录


├─bin
│    www       // 后端 服务器
│    database  // 后端 数据库
│    socket    // 后端 socket
|    router    // 后端 路由
├─sessions     // 后端 session
├─public
│    src       // 前端 开发目录
│    dist      // 前端 线上目录
├─routes       // 前端 路由
├─view         // 前端 页面
├─app.js       // 前端 服务器
├─gulpfile.js  // 前端 Gulp
├─package.json

安装

  • 项目基于MIT协议开源
  • 启动项目以前,请确保已经安装mongodb,并在package.json中修改MongoDB的安装路径(--dbpath)

Windows安装教程 | Linux安装教程


git clone https://github.com/bergwhite/nodejs-chat  // 克隆项目
cd nodejs-chat  // 进入目录
npm install  // 安装依赖
npm run build  // 构建 线上代码
npm run mongod // 开启 数据库
npm run start // 开启 聊天室

功能

  • 聊天

    • √ 群聊
    • × 私聊
    • √ 表情
    • × 斗图
    • × 更多表情
    • √ 聊天机器人(图灵)
  • 用户

    • √ 在线清单
    • √ 随机头像
    • √ 上线通知
    • √ 离线通知
    • √ 消息推送
    • × 上传头像
    • √ 在线统计
  • 房间

    • √ 房间列表
    • √ 添加房间
    • × 搜索房间

优化

  • 基础

    • √ 代码压缩
  • 展示

    • √ 以前未设置头像的,显示默认头像
    • √ 加载速度优化
    • × 界面换肤
  • 开发

    • √ 组件化开发
    • √ 模块化开发
    • REST API
    • √ 使用PM2部署
    • √ 前后端分离
    • × 代码规范
    • × 测试用例
  • 安全

    • √ 密码使用MD5+SALT保存
    • √ 聊天内容过滤< >等特殊标签
  • 认证

    • √ Session
  • 部署

    • Linux & PM2

踩坑

图灵机器人不支持跨域,通过代理中间件把请求代理到本地。


var proxy = require('http-proxy-middleware');

app.use('/api/robot', proxy({
  target: 'http://www.tuling123.com',
  changeOrigin: true
}));

Gulp使用通配符对多个文件处理,会压缩到一个文件中。以下是分别进行压缩的方式。


const gulp = require('gulp'),
      minifyJS = require('gulp-uglifyjs'),
      babel = require('gulp-babel'),
      rename = require('gulp-rename');

const compileDir = {
  css: {
    src: 'public/src/css/index.less',
    dest: 'public/dist/css'
  },
  js: {
    src: 'public/src/js/',
    dest: 'public/dist/js'
  }
};

gulp.task('compile-js', () => {
  const JSTaskList = ['index', 'login', 'mobile', 'room', 'roomAdd', 'userInfoMod', 'roomMember']
  return JSTaskList.map((e) => {
    gulp.src(`${compileDir.js.src}${e}.js`)
      .pipe(babel({
        presets: ['es2015']
      }))
      .pipe(minifyJS())
      .pipe(rename((path) => {
        path.basename += '.min'
      }))
      .pipe(gulp.dest(compileDir.js.dest))
  })
});

gulp-uglifyjs - No files given; aborting minification


之前删除了一个JS文件,但是没有删除JSTaskList中的对应值。编译时会报上面的错误。删除对应的值就编译成功了。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].