Open source free more beautiful background management system

Time:2021-4-27

Open source free more beautiful background management system

Cool admin (Midway version) is a cool background authority management system, which is open source and free, modular, plug-in, rapid development of crud, convenient and rapid construction of iterative background management system, and supports serverless, docker, ordinary server and other ways of deployment

Open source address

  • back-end

https://github.com/cool-team-…

https://gitee.com/cool-team-o…

  • front end

https://github.com/cool-team-…

https://gitee.com/cool-team-o…

Technology stack

  • Back end:node.js midway.js egg.js mysql typescript
  • front end:vue.js element-ui jsx vuex vue-router

If you are a front-end, the back-end technology selection is particularly friendly to you, and the front-end developers can get started more quickly.
If you are a back-end, the syntax of typescript is very similar to Java, PHP and so on. Everything seems so familiar.

demonstration

https://show.cool-admin.com

  • Account: admin
  • Password: 123456

Open source free more beautiful background management system

file

https://admin.cool-js.com

Project front end

https://github.com/cool-team-official/cool-admin-vue

QQ group

Group 2: 539478405

Wechat group

Open source free more beautiful background management system

WeChat official account

Open source free more beautiful background management system

function

Modify the database configuration. The configuration file is located insrc/config/config.local.ts

The database is mysql(>=Version 5.7)The first startup will automatically initialize and import data

config.orm = {
    type: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    username: 'root',
    password: '',
    database: 'cool-admin',
    synchronize: true,
    logging: true,
}

Install and run

$ npm i
$ npm run dev
$ open http://localhost:8001/

Note: if your network is not good, you can try to use itcnpm, or switch your mirror source

Curd

Most of the background management systems or API services manage the data, so you can see a lot of crud scenarios (add, delete, modify and query). Cool admin encapsulates a lot of them, making the amount of coding extremely small.

Create a new data table

src/modules/demo/entity/goods.ts, the project startup database will automatically create the table without manual creation

import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from 'midwayjs-cool-core';
import { Column } from 'typeorm';

/**
 *Merchandise
 */
@EntityModel('demo_app_goods')
export class DemoAppGoodsEntity extends BaseEntity {

    @Column ({comment: 'title'})
    title: string;

    @Column ({comment: 'picture'})
    pic: string;

    @Column ({comment: 'price', type: 'decision', precision: 5, scale: 2})
    price: number;

}

Write API interface

src/modules/demo/controller/app/goods.ts, quickly write 6 API interfaces

import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from 'midwayjs-cool-core';
import { DemoAppGoodsEntity } from '../../entity/goods';

/**
 *Merchandise
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: DemoAppGoodsEntity
})
export class DemoAppGoodsController extends BaseController {
  /**
   *Other interfaces
   */
  @Get('/other')
  async other() {
    return this.ok('hello, cool-admin!!!');
  }
}

In this way, we have completed the writing of six interfaces, and the corresponding interfaces are as follows:

  • POST /app/demo/goods/addnewly added
  • POST /app/demo/goods/deletedelete
  • POST /app/demo/goods/updateto update
  • GET /app/demo/goods/infoSingle message
  • POST /app/demo/goods/listList information
  • POST /app/demo/goods/pagePagination query (including fuzzy query, field full matching, etc.)

deploy

$ npm start
$ npm stop

Built in instruction

  • usenpm run lintTo do the code style check.
  • usenpm testTo perform unit tests.