router.post('/api/login/createAccount',(req,res) => { // 这里的req.body能够使用就在index.js中引入了const bodyParser = require('body-parser') let newAccount = new models.Login({ account : req.body.account, password : req.body.password }); // 保存数据newAccount数据进mongoDB newAccount....
1、在项目的根目录新建一个叫server的目录,用于放置Node的东西。进入server目录,再新建三个js文件: index.js (入口文件) db.js (设置数据库相关) api.js (编写接口) index.js文件代码: View Code db.js文件代码: View Code api.js文件代码: View Code db.js注释 2、对比node_modules目录缺少body-parser模...
9M+vehicles serviced “We use MongoDB as the core database for our services, so any new innovative idea or new service we build, we automatically say, ‘We’re going to use MongoDB as the core platform,’ knowing that it’s going to give us the reliability and the scalability that we...
前言 本文主要介绍了利用Vue.js+Node.js+MongoDB实现一个博客系统,这个博客使用Vue做前端框架,Node+express做后端,数据库使用的是MongoDB。实现了用户注册、用户登录、博客管理、文章编辑、标签分类等功能 实现的功能 1.文章的编辑,修改,删除 2.支持使用 Mar
vue端口:本地是8080 服务端是:80 本地开发配置 本地开发基于vue cli 端口是 8080如果请求api的时候在前缀加上localhost:3000会提示跨域问题,我们可以使用下面方式来解决这个问题 在vue项目路径找到这个文件 /vue-item/config/index.js 找到这行代码: proxyTable: {} ...
cd vue-project-backend npm install npm start 1. 2. 3. 此时在浏览器输入http://localhost:3000即可访问初始页面 连接MySQL 首先在控制台安装mysql的插件 npm install mysql 1. 然后在项目根目录下创建config文件夹,在里面新建db.js和sqlMap.js两个文件。
一、创建一个vue项目 用脚手架vue-cli搭建一个项目,数据请求用axios方式,写几个按钮用来调接口(vue这块不做多解释,不懂的可以先去官网学习vue-cli:https://cli.vuejs.org/zh/guide/cli-service.html axios:http://www.a
见https://scotch.io/courses/build-an-online-shop-with-vue/enabling-cors Schemas & Models 为了通过mongoose 和mongoBD数据库交互,你需要定义schemas and models。 即数据结构,数据类型。 具体见:https://scotch.io/courses/build-an-online-shop-with-vue/schemas-models ...
5、用vuex来进行状态管理,此时state.js (1)state.js /*定义状态对象*/exportdefault{ userInfo:{}//保存提交的用户信息} (2)mutation-type.js export const RECEIVE_USER_INFO ='receive_user_info'//接受用户信息export const RESET_USER_INFO ='reset_user_info'//重置用户信息 ...
Vuejs部分 1.vue的子组件是指:同一个页面上有两个组件,一个组件放在另一个组件里面 //父组件:Article.vue<template>//这个组件中的东西<ArticleDetailtitle="test"></ArticleDetail></template>importArticleDetailfrom"./ArticleDetail";exportdefault{name:"Article",components:{ArticleDetail},data:function(){...