Giter Site home page Giter Site logo

z's Introduction

z

基于以下技术构建

  • Node.js & MidwayJS(EggJS)
  • TypeScript
  • Redis
  • MySQL 5.7 以上
  • Sequelize
  • TypeORM 底层还在进行大重构,暂时不适宜用于生产环境
  • Socket.io
  • GraphQL
  • ...

注意事项

因为 midwayjs 使用了 IoC 容器进行依赖解耦,所以开发方式会跟 eggjs 有些不一样,建议先阅读 midwayjs 官方文档Injection 文档

验证码模块使用了 node-canvas 库, 所以请先根据 node-canvas 文档 安装好相应的依赖

模块开发目录

开发目录为:src/app/modules/*

快速开始

请确保已经拉取项目到本地环境,并且安装配置好 Node/yarn

1、安装依赖

yarn

2、copy config 配置

cp src/config/config.example src/config/config.default.ts

然后修改对应的配置信息

3、执行数据库迁移

sequelize-cli 的数据库迁移并不好用,主要是它没办法定义多目录的 migration, 所以当前使用的是 typeorm 的数据库迁移功能

遇到出现 UnhandledPromiseRejectionWarning: QueryRunnerAlreadyReleasedError: Query runner already released. Cannot run queries anymore. 错误,请无需担心,这是 typeorm 的一个 bug, 不会影响迁移结果

yarn typeorm migration:run

4、运行

yarn dev

部署

更多请看 midway 部署

使用 docker 详见 docker 手册跟 Dockerfile

使用 pm2

pm2 start ecosystem.config.js

使用 egg-scripts

yarn start

辅助开发的 Cli 命令

对应代码目录: src/console

// 待补充

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.