Coder Social home page Coder Social logo

anna's Introduction

记录

npm init -y

cnpm i express --save

cnpm art-template --save

cnpm express-art-template --save

新建app.js

vue init webpack webapp --> 新建webapp文件

修改config.js中打包路径: index.html为'../../views/index.html',dist为'../../dist'

修改config.js代理: proxyTable: { '/api': { target: 'http://127.0.0.1:3000', changeOrigin: true, pathRewrite: { '^/api': '' } } },

然后就有了dist和views目录,express貌似会去views下找html,然后设置app.use('/static', express.static(path.join(__dirname, 'dist/static')))为静态文件目录

新建.gitignore文件

新建api文件夹,用于存放后台文件,里面建个index.js: app.js里写/user,api里写/users,则在vue里写api/user/users进行访问

webapp下安装npm包: cnpm install node-sass --save-dev cnpm install sass-loader --save-dev cnpm install axios --save

webapp下新建api/index.js,配置axios参数,然后添加了config下dev.env.js和prod.env.js中的BASE_API参数,这样则写在vue里的就是user/users不需要加api了

IE下报Promise未定义,安装npm包:cnpm install --save-dev webpack-server -- 然而并不能解决报错

config/index.js下改成cssSourceMap: false,去掉打包后的.map文件

anna's People

Watchers

 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.