Code Monkey home page Code Monkey logo

node-login's Introduction

node-login

node实现的登录、注册Demo

该Demo根据菜鸟教程的练手项目,请提前到菜鸟教程的官网查看nodejs的相关教程,根据教程实际操作一遍,然后自己动手去实现登录、注册功能,此Demo只作参考,不符合前端相关规范。

使用的技术栈

node+express+mongodb

项目目录结构

  • node_modules: 第三方模块目录
  • public: 公共文件目录(js、css、image)
  • login.html:登录页面
  • register.html:注册页面
  • main.html:主页面
  • db.js:数据库相关封装(数据库添加、查询)
  • login.js:接口启动文件(登录、注册接口)

登录场景

(1)用户名不能为空; (2)密码不能为空; (3)用户名和密码不为空的情况下,查询数据库,判断用户是否存在。 如果存在,判断用户名和密码是否一致,一致登录成功;不一致返回用户名或密码错误; 如果不存在,直接返回不存在该用户。

注册场景

(1)用户名不能为空; (2)密码不能为空; (3)用户名和密码不为空的情况下,查询数据库,判断用户是否存在。 如果存在,返回该用户已存在,可直接登录; 如果不存在,注册用户,插入数据库。

部分操作演示

登录

主页

注册

插入数据库

项目开发

安装依赖:npm install

项目启动

定位到项目,打开命令行,输入命令:node login.js

node-login's People

Contributors

lemon-yan avatar

Stargazers

 avatar Roman avatar Kaien Shi avatar TheWorldIsNotEnough avatar  avatar 沐峰 avatar  avatar minured avatar o023 avatar  avatar 张振喜 avatar  avatar  avatar arron_tsien avatar

Watchers

 avatar

node-login's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.