GithubHelp home page GithubHelp logo

unionblog's Introduction

配置koa+react开发环境

下载项目之后,老规矩 npm install ,然后开启 npm startnpm run dev-build koa服务和webpack打包一起开启,访问9002端口

2017-09-23

  • 今天早上打开电脑,开始配置koa+react的开发环境,遇到不少坑。带着几个疑问去配置这个环境。

  • 疑问1: 一般koa开发web,多数都是用到模板(ejs、pug等),react要如何集成进去??

  • 疑问2: 如果要集成的话,集成的入口在哪里?

  • 疑问3: koa没有种子项目?(手动搭建有点累的。。。)

1、疑问3谷歌一下就解决了,感谢桑世龙老师的koa-generate,一键生成koa开发环境

2、疑问1就有点麻烦了,查阅各种资料之后,我大概的思路是这样的,设置一个文件夹client,在里面正常写react代码,然后再新建一个文件夹dist,webpack打包client的代码,生成bundle文件传入dist文件夹,然后再手动写一个index.html,作为react的根节点入口。然后koa渲染模板的路径设置为dist文件夹下的index.html,这样就能顺利的集成react。总结一下就是webpack把react的业务代码打成单个bundle.js脚本,单独引入index.html,然后作为koa模板引擎的入口

  • 完成推酷技术首页的数据爬取

2017-10-08

  • 时间未免过得有点快,懒癌发作这么久没有写这个项目,今天加了一个上拉加载更多功能

2017-10-10

  • 今天项目加了react-router作为UI层的路由,拓展出一个房产网站模块,之后会爬取各大房产网站集中信息

2017-11-14

  • 一个月了。。。。公司新需求做了一个月,才有空重新拾起这个项目。。。惭愧。这次更新加了另外几个IT门户网站。然后把前端路由重新整理了一下。还有一个待解决的问题就是在线热更新。

2017-11-19

  • 优化了一下开发体验,加了webpack-dev-server,前端开发实时更新,本地开发端口为3001,koa的接口通过devServer.proxy属性,映射到9002端口(本地服务的端口),踩了一些坑,不过代码是实现了,还需要完善一下结构.

unionblog's People

Contributors

nick930826 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

unionblog's Issues

Awesome!

很少有年轻人像你一样静下来搞自己的东西了。

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.