当前位置: 首页 > 软件库 > Web应用开发 > Web框架 >

react-blog

授权协议 View license
开发语言 JavaScript
所属分类 Web应用开发、 Web框架
软件类型 开源软件
地区 不详
投 递 者 蔡宏大
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

React Blog

For chinese , you can visit this 中文

One-click installation & deployment of the React blog, freeing your hands so that you only need to change the configuration file to have a perfect personal technical blog!

This ReadMe file contains the following:

  1. How to install and deploy a blog
  2. How to configure front-end page information
  3. How to configure sensitive back-end information

Table of Contents

Background

React Blog was originally built on the basis of project alvin0216/react-blog which was created by alvin0216 , In order to fix some known issues and add more personalized elements, Last but no Least, I have added various security guarantees of the website, making it more cool and easier to use.

In order to build a personal website, you first need to rent a cloud server (centos is generally used instead in this article), and use Alibaba Cloud/Tencent Cloud/AWS to host the website. Or you can use Ngrok to do intranet penetration and deploy the website on your PC.

Install

If you want to deploy on the Centos server, you can directly use our one-click installation deployment script:

$ sh install.sh

If you want to install and configure yourself, use node,npm,yarn,forever for this project. Please make sure You have performed the correct installation locally.

$ npm install --global yarn
$ npm install --global forever

Usage

If you use the one-click installation script mentioned above, please pay attention to whether the port is occupied when starting later:

$ yum install lsof
$ lsof -i:80
$ lsof -i:6060

If there is port occupation, please end the process or change the port

Then execute the following instructions for production deployment

$ cd src
$ yarn build
$ nohup serve -s build -l 80 &
$
$ cd server
$ forever start app.js

Or for development environment deployment

$ cd src
$ nohup yarn dev
$
$ cd server
$ forever start app.js

Features and Personal Configuration

Features

  • Front Desk: Homepage + List Page + Search Page + Category Page + Tab Page
  • Backstage: article management + user management
  • Responsive, article anchor navigation, back to top, markdown code highlighting, mathjax support
  • Users: users on the site, users authorized to log in by a third-party github
  • Users can comment and reply, as well as the status of mail notification reply
  • md file import and export function! You can directly upload the md file to generate an article
  • Separation of private and public articles
  • One-click comment without registration
  • Homepage background
  • Top of article
  • Gossip
  • Get the mailbox secret dynamically
  • Password transmission encryption
  • Background chart
  • Smart Recommendation (Related Recommendation)

Personalized Configuration

Personalized configuration is configured through src/config.js

import React from 'react'
import { Icon } from 'antd'
import SvgIcon from '@/components/SvgIcon'

import Href from '@/components/Href'
import MyInfo from '@/views/web/about/MyInfo'
import {GithubFill} from 'utils/antdIcon'
// API_BASE_URL
export const API_BASE_URL = 'http://120.79.229.207:6060'
// export const API_BASE_URL = 'http://127.0.0.1:6060'
// project config
export const HEADER_BLOG_NAME = '菜园子' // header title 

// === sidebar
export const SIDEBAR = {
    avatar: require('@/assets/images/avatar.jpeg'), // sidebar image
    title: '种菜的小朋友', // title
    subTitle: 'Carpe diem', // subtitle
    // personal website
    homepages: {
    github: {
        link: 'https://github.com/panyunyi97',
        icon: <GithubFill className='homepage-icon' /> 
    },
    juejin: {
        link: 'https://juejin.im/user/96412755827687',
        icon: <SvgIcon type='iconjuejin' className='homepage-icon' />
    }
    },
    //frindslink in sidebar
    friendslink: {
    lizi: {
        link: 'http://blog.liziyang.co/',
        img: 'http://blog.liziyang.co/images/pikachu.jpg',
    },
    wizchen: {
        link: 'http://blog.wizchen.com',
        img: 'https://cdn.jsdelivr.net/gh/wizcheu/content1@main/img/header.gif'
    }
    }
}

// === discuss avatar
export const DISCUSS_AVATAR = SIDEBAR.avatar // your default avatar in comment line
/**
 * github config
 */
export const GITHUB = {
    enable: true, // github 第三方授权开关
    client_id: '87a4f88b943adaafd44a', // Setting > Developer setting > OAuth applications => client_id
    url: 'https://github.com/login/oauth/authorize' // github auth page
}

export const ABOUT = {
    avatar: SIDEBAR.avatar,
    describe: SIDEBAR.subTitle,
    discuss: true, // open the comment function on 'about me' page 
    renderMyInfo: <MyInfo /> // 我的介绍 自定义组件 => src/views/web/about/MyInfo.jsx
}

// 公告 announcement
export const ANNOUNCEMENT = {
    enable: true, // 是否开启
    content: (
    <>
        个人笔记网站,请访问
        <Href href='https://www.yuque.com/zhongcaidexiaopengyou/kb'> panyunyi's note</Href>
    </>
    )
}

Personalized Information Configuration

Personal information is configured through src/view/web/about/index.jsx

import React from 'react'

// components
import { Divider, Rate, Icon, Avatar } from 'antd'
import Href from '@/components/Href'
import SvgIcon from '@/components/SvgIcon'
// rate is the star
// label is your skills
const skills = [
  {
    label: '具备扎实的Java功底,熟练了解各种特性',
    rate: '5'
  },
  {
    label: '具备扎实的Python功底,熟练了解各类特性',
    rate: '5'
  },
  {
    label: '具备扎实的 Javascript 基础,熟练使用 ES6+ 语法。',
    rate: 4
  },
  {
    label: '具备不那么扎实的 C++ 基础,没熟练了解各类特性',
    rate: 3
  },
  {
    label: 'Android 顶级玩家',
    rate: 5
  },
  {
    label: '熟悉 React 并理解其原理,熟悉 Vue 框架及其用法。',
    rate: 5
  },
  {
    label: '熟悉 Flask/Django 并理解其原理,熟悉各类用法。',
    rate: 5
  },
  {
    label: 'Spring 全家桶爱好者,后端中级开发者,netty/kafka/hadoop/Storm/Spark',
    rate: '3'
  },
  {
    label: '3D 轻量级玩家,openGL小菜,3D shape segmentation & 3D scene segmentation',
    rate: '3'
  },
  {
    label: '熟练使用 Webpack 打包工具,熟悉常用工程化和模块化方案。',
    rate: 4
  },
  {
    label: '熟悉 Koa、Mysql,针对需求可以做到简单的数据库设计、接口的开发与设计!',
    rate: 3
  },
  {
    label: '熟悉 HTTP 协议,缓存、性能优化、安全等,了解浏览器原理。',
    rate: 4
  },
  {
    label: '熟悉常用的算法与数据结构',
    rate: 3
  }
]

const MyInfo = () => {
  return (
    <>

      <Divider orientation='center'>关于我</Divider>

      <ul className='about-list'>
        <li>Name:潘云逸</li>
        <li>Bachelor: 中央财经大学(CUFE)CS</li>
        <li>Master: 南京大学(NJU)CS</li>
        <li>
          Contact me:
          <Icon type='qq' /> 779087031
          <Divider type='vertical' />
          <SvgIcon type='iconemail' style={{ marginRight: 5, transform: 'translateY(2px)' }} />
          <a href='mailto:cuferpan@gmail.com'>cuferpan@gmail.com</a>
        </li>
        <li>Work Base:ShangHai</li>
        <li>
          friends link:
          <Href href='http://blog.liziyang.co/'>栗子栗子</Href>
          <Divider type='vertical' />
        </li>
        <li>
          skills
          <ul>
            {skills.map((item, i) => (
              <li key={i}>
                {item.label}
                <Rate defaultValue={item.rate} disabled />
              </li>
            ))}
          </ul>
        </li>
        <li>
          others
          <ul>
            <li>常用开发工具: idea、pycharm、vim、vscode、webstorm、git</li>
            <li>熟悉的 UI 框架: antd、element-ui</li>
            <li>具备良好的编码风格和习惯,团队规范意识,乐于分享</li>
          </ul>
        </li>
        <li>
          publication
          <ul>
            <li>ICPR 2020: Two Stage Scene Segmentation Base on Self-attention Mechanism</li>
            <li> 安徽大学学报: 图核综述 </li>
            <li> 专利: 一种基于机器学习的CME事件跟踪方法 </li>
            <li> 译著: 计算机视觉基础 </li>
          </ul>
        </li>
      </ul>
    </>
  )
}

export default MyInfo

Background sensitive information configuration

Sensitive information in the background is configured through server\config\index.js, including the startup port of the background, the configuration of the database, and the configuration of the email notification of comments.

const devMode = process.env.NODE_ENV === 'development'
const config = {
  PORT: 6060, // start port
  ADMIN_GITHUB_LOGIN_NAME: 'panyunyi97', // your github name
  GITHUB: {
    client_id: '87a4f88b943adaafd44a',
    client_secret: '9494809fc485d93084452fbf8b21ba2a829bfb82',
    access_token_url: 'https://github.com/login/oauth/access_token',
    fetch_user_url: 'https://api.github.com/user', // 用于 oauth2
    fetch_user: 'https://api.github.com/user' // fetch user url https://api.github.com/users/gershonv
  },
  EMAIL_NOTICE: {
    // mail notification
    // detail: https://nodemailer.com/
    enable: true, // switcher
    transporterConfig: {
      host: 'smtp.qq.com',
      port: 465,
      secure: true, // true for 465, false for other ports
      auth: {
        user: '779087031@qq.com', // generated ethereal user
        pass: 'f2bbfe7cf1bcb8253a65c06701fbbbbf8c910be44ecc1a430497d4879db0d71d' // generated ethereal password 
      }
    },
    subject: 'panyunyi的博客 - 您的评论获得新的回复!', // subject for the notification mail
    // main content of the mail
    text: '您的评论获得新的回复!',
    WEB_HOST: 'http://www.panyunyi.cn' // email callback url
  },
  TOKEN: {
    secret: 'root', // secret is very important!
    expiresIn: '720h' // token exist time
  },
  DATABASE: {
    database: 'test',
    user: 'root',
    password: '123456Root!',
    options: {
      host: 'localhost', //  host ip
      dialect: 'mysql', // sql dilect
      pool: {
        max: 5,
        min: 0,
        acquire: 30000,
        idle: 10000
      },
      define: {
        timestamps: false, // timestamps is set to 'off' default
        freezeTableName: true // table name not add s in default
      },
      timezone: '+08:00'
    }
  }
}

// production env configuration
if (!devMode) {
  console.log('env production....')

  // ==== configure database
  config.DATABASE = {
    ...config.DATABASE,
    database: '', // database name
    user: '', // user name
    password: '' // password
  }

  // configure github auth
  config.GITHUB.client_id = ''
  config.GITHUB.client_secret = ''

  // ==== configure token secret key
  config.TOKEN.secret = ''

  // ==== configure mailbox

  // config.EMAIL_NOTICE.enable = true
  config.EMAIL_NOTICE.transporterConfig.auth = {
    user: '779087031@qq.com', // generated ethereal user
    pass: 'f2bbfe7cf1bcb8253a65c06701fbbbbf8c910be44ecc1a430497d4879db0d71d' // generated ethereal password 
  }
  config.EMAIL_NOTICE.WEB_HOST = 'https://panyunyi.cn'
}

module.exports = config

Maintainers

@panyunyi97

Contributing

Feel free to dive in! open an issue or submit PRs.

React-blog follows the Contributor Covenant Code of Conduct.

License

MIT © Richard Littauer

  • my-react-blog 前端使用了react,后端使用springcloud, oauth2做统一认证,springboot2.0,图片上传使用腾讯COS 项目比较简单,也有不少坑,仅做学习参考 码云: 后端springcloud 前端react GitHub: 前端react 后端springcloud 项目介绍 react实现个人博客,关于CSS我是渣渣,不太会,样式我趴了简书和知乎 一些

  • 前言 本来体验下react-router的,然后 去react-router npm查看,发现了官方的提示如下: 这个包为 React Router 提供了核心路由功能,但你可能不想直接安装它。如果您正在编写将在浏览器中运行的应用程序,您应该安装 react-router-dom。同样,如果您正在编写 React Native 应用程序,则应该安装 react-router-native。这两个都

  • 想用react-router配合ts学习react,刚拉好项目,第一步做路由就出问题了: 我在安装了react-router/react-router-dom的情况下,在ts文件里面引用,但是编辑器都老是给我报红线,提示我找不到模块,百思不得其解,node_modules里面也是有这个的。强行启动项目照样报错。 最后找了一圈网上的问题,最后知道是因为ts的问题,我得再下载依赖@types/reac

 相关资料
  • 问题内容: 我注意到可以这样导入: …或像这样: 第一个导入模块中的所有内容(请参阅:导入整个模块的内容) 第二个仅导入模块导出(请参阅:导入默认值) 似乎这两种方法是不同的,并且根本上是不兼容的。 为什么它们都起作用? 请参考源代码并解释该机制…我有兴趣了解其工作原理。 ES6常规模块信息回答了该问题。 我在问使模块像这样工作的机制。在这里,它似乎与源代码中的 “ hacky”导出机制有关,但尚

  • This is a very simple blog built with Django, Django REST Framework, React/Redux, and Bootstrap, deployed with Docker, and served with nginx-uwsgi. It can be useful as an example of integrating Django

  • 这篇快速上手指南会教你如何将TypeScript与React结合起来使用。 在最后,你将学到: 使用TypeScript和React创建工程 使用TSLint进行代码检查 使用Jest和Enzyme进行测试,以及 使用Redux管理状态 我们会使用create-react-app工具快速搭建工程环境。 这里假设你已经在使用Node.js和npm。 并且已经了解了React的基础知识。 我们之所以使

  • 我已经改用react Native制作跨平台应用程序(虽然没有制作)。我只是想要一个答案,我的问题,反应和反应之间的区别。我在网上搜索了一下,但没有找到合适的答案。

  • 问题内容: 与 哪个更好,为什么? 还是除了以后编写更少的代码外没有其他区别? 写作是否意味着只导入Component对象? 问题答案: 让您代替。它减少了React名称空间的键入和重复,这通常是一种理想的现代编码约定。 此外,Webpack 2和Rollup之类的工具会“摇晃”,这意味着任何未使用的导出都不会捆绑到您的最终代码中。使用/,您可以保证所有React的源代码都将被捆绑。使用,某些工具

  • 本文向大家介绍react-native 启动React Native Packager,包括了react-native 启动React Native Packager的使用技巧和注意事项,需要的朋友参考一下 示例 在最新版本的React Native上,无需运行打包程序。它将自动运行。 默认情况下,这将在端口8081上启动服务器。要指定服务器所在的端口