#Front and back management system based on koa2

Time:2020-1-13

koa2

Koa2 framework, mongodb as database, ES6 / 7 syntax writing, Babel compiling es syntax.

Add TS syntax support to ing

Front and back end separation, background management system, KOA back end

At present, the system includes four modules: article publishing management system, tag system, comment system and user system

Technology stack

Using koa + mongoose to develop;

  • Using koa2.0 as development framework
  • Mongoose as a database, saving data
  • Using JWT to generate and verify token
  • Project writing with ES6 syntax
  • File structure is split by MC
  • Compiling ES6 / 7 / 8 with Babel register
  • Eslint syntax rules

Directory structure under server:

.
|——server
|| - config global configuration
|| - constant constant
|| -- index.js exposes all constants
|| └ -- user.js user constant
|| -- logical processing of corresponding route of controller
|| -- article.js article controller interface
||└ -- comment.js comment controller interface
|| └ - tag.js tag controller interface
|| └ -- user.js user controller interface
|| - Middleware routing Middleware
|| - model mongoose database model
|| - articlemodel.js article model
|| -- tagmodel.js tag model
||└ -- usermodel.js user model
||└ - commentmodel.js comment model
|| - exposure of mongoose database method
|| - public static resource directory
|| - router routing file
||| - index.js route
|| - api.js API route
||└ -- user.js user route
|| - utils public method
|| -- app.js app entry file

Debugging operation

$ yarn install 

<! -- management permission setting needs to be enabled -- >
$mongod // enable mongodb

$NPM run dev // local test service

API interface

Back end interface documentation