前端react+redux+koa寫的博客引薦

React-Node搭建的博客

曾用的php+mysql+js寫的博客,現在看來已很low了,所以用現在最火的
react+koa框架重構一下。
先上地點吧:現在線上版本http://www.liuweibo.cn/,要想看到最新版本和代碼,請看Github地點
https://github.com/Weibozzz/react-blog.git
由於博客正在開闢中,部份功用能夠運用,由於還沒有優化,首屏能夠有點大,也許10幾秒,背面會逐步修正的,嘿嘿

用到的重要手藝棧

React+React-router+redux+antd+axios+webpack+es6+koa

用到的庫和版本。

{
  "name": "app2",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "antd": "^3.5.1",
    "autoprefixer": "7.1.6",
    "axios": "^0.18.0",
    "babel-core": "6.26.0",
    "babel-eslint": "7.2.3",
    "babel-jest": "20.0.3",
    "babel-loader": "7.1.2",
    "babel-preset-react-app": "^3.1.1",
    "babel-runtime": "6.26.0",
    "case-sensitive-paths-webpack-plugin": "2.1.1",
    "chalk": "1.1.3",
    "css-loader": "0.28.7",
    "dotenv": "4.0.0",
    "dotenv-expand": "4.2.0",
    "file-loader": "1.1.5",
    "fs-extra": "3.0.1",
    "highlight": "^0.2.4",
    "highlight.js": "^9.12.0",
    "html-to-markdown": "^1.0.0",
    "html-webpack-plugin": "2.29.0",
    "html2markdown": "^1.1.0",
    "jest": "20.0.4",
    "object-assign": "4.1.1",
    "postcss-flexbugs-fixes": "3.2.0",
    "postcss-loader": "2.0.8",
    "promise": "8.0.1",
    "raf": "3.4.0",
    "react": "^16.3.2",
    "react-dev-utils": "^5.0.1",
    "react-dom": "^16.3.2",
    "react-redux": "^5.0.7",
    "react-router-dom": "^4.2.2",
    "redux": "^4.0.0",
    "redux-thunk": "^2.2.0",
    "resolve": "1.6.0",
    "simplemde": "^1.11.2",
    "style-loader": "0.19.0",
    "sw-precache-webpack-plugin": "0.11.4",
    "url-loader": "0.6.2",
    "webpack": "3.8.1",
    "webpack-dev-server": "2.9.4",
    "webpack-manifest-plugin": "1.3.2",
    "whatwg-fetch": "^2.0.3"
  },
  "scripts": {
    "start": "node scripts/start.js",
    "build": "node scripts/build.js",
    "test": "node scripts/test.js --env=jsdom"
  },
  "devDependencies": {
    "marked": "^0.3.19",
    "react-css-modules": "^4.7.2"
  }
}

選用的手藝棧

前端

在前端三大框架的挑選,Angular,React,Vue,運用了前端最為盛行的React框架,實在當時能夠用Vue,
由於公司用的Vue也比較熟習,用的比較多,也簡樸疾速,沒有打仗過React的我,只聞其牛,也給本身一個應戰,進修个中的頭腦,
Angular是由於在Github的star遠遠落後於前二者,固然背面會相識它,現在就用React了合營用了阿里的antd。

後端

重構博客嘛,之前用php寫的背景,所以略懂一些,作為一個前端開闢,目的就是全棧嘛,選用了最為盛行的node,也用了現在最為盛行的koa作為
後端合營mysql。

文本編輯

博客,那固然要舉行發表文章和修正文章,我選用了Markdown語法,
藉助了marked庫。

現在博客存在的題目

文章宣布和文章修正,由於文章能夠比較長,另有題目就是存入數據庫的時刻
有特別字符須要變動,所以有時刻會失利,正在修正中……

運轉

1.克隆代碼

git clone

2.進入後端啟動效勞,固然要裝置數據庫mysql了

cd koa2-router-demo
npm install 
npm start

3.進入前端文件

cd app2
npm install
npm start

注重:先啟動node後端效勞,再啟動前端,由於前台須要後端供應的數據效勞嘛。

    原文作者:Weibozzz
    原文地址: https://segmentfault.com/a/1190000014908102
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞