Coder Social home page Coder Social logo

fffff0001 / myresume Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 2.47 MB

vue-mongodb-express完成的简历项目,前端页面搬过来https://github.com/luosijie 的页面,做了一些修改,加入Express框架,配置文件同步到mongodb

JavaScript 79.68% HTML 0.43% Vue 19.16% CSS 0.72%

myresume's Introduction

express+mongodb+webpack+vue的简历项目

  • 更新,添加登录注册逻辑。

  • 登录账号将注册用户并绑定resume.config.js中的配置数据。同步数据库更改简历数据的方式,一个是更改配置文件然后点击同步按钮,一个通过修改数据到完成。

  • 无法直接通过修改页面同步修改后台数据,修改页面功能只是在保存图片,当前问题所在在于,修改页面使用的是contenteditable="true"属性,但是无法实现与数据双向绑定,如果依赖于监听的话又会代码很乱很麻烦。

  • 当前问题还是在Vue跨域的问题,虽然通过proxyTable可以解决开发环境的跨域问题,但是在生产环境时会丢失主域的,这个需要后台配合设置跨域,可以使用nginx反向代理。

  • 关于生产环境node服务器部署,推荐Docker+Nginx+PM2处理访问量比较大的站点,我也在看这部分。当然也有同学推荐用用forever替代PM2,这部分学习一下之后再进行讨论。

后端采用node.js,使用express框架搭建路由和中间件的处理。 这里使用的monogoose只是一个orm,一个对象关系映射的操作工具。 webpack进行vue的配置。 server里面是后端代码,后端的入口和中间件的配置在server.js里面,在这里面配置的mongoose。 现在nosql的数据库很好用,简单,但是如果多表连表的查询我还是有点不太清楚怎么办,因为是基于model层的处理。 这里简单介绍一下mongoose的使用。 首先建立了一个models,通过schema来映射字段,model也包含操作的能力。

然后简单看一下我的后台中间件的操作,其实crud就是直接使用Model。

遇到的问题: 跨域问题,首先通过设置使服务端具备接受跨域的请求的能力。

然后测试发现依然会有问题,但是在首页我会调一个get和一个post,get的接口是没有问题,post的还是会提示Access-Control-Allow-Origin的问题。 然后通过Webpack的代理解决的这个问题,这个过程相当于一个代理转发,将原接口代理到你想要的域中。 具体看代码: 在config》index.js中配置proxyTable。

运行

  • 1 安装好环境包括node+vue+mongo
  • 2 连接mongo数据库(要到mongodb/bin/mongod,最好写一个脚本来连接。)
  • 3 运行node服务器(node server)
  • 3 运行Vue(npm run dev)

对于mongo来说推荐一个插件,intellij idea系列的都可以安装(AS/WebStorm):Mongo Plugin很好用,比那些妖艳笨拙的图形化好很多。

myresume's People

Contributors

ulanxx avatar

Watchers

James Cloos avatar

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.