create-nserve 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nserve",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "main": "bin/index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -1,6 +1,6 @@
1
1
  import express from 'express'
2
2
  import routers from './handler/router'
3
- import emysql from '@dpapejs/emysql'
3
+ import emysql from '@aicblock/emysql'
4
4
  import { LoadConfig } from '@aicblock/nserve/lib/tools'
5
5
  import { join } from 'path'
6
6
  import models from '@/model'
@@ -17,15 +17,16 @@ const initDatabase = async () => {
17
17
  }
18
18
  try {
19
19
  global.mysql = new emysql({
20
- database,
21
- user,
22
- password,
23
- port,
24
- host,
20
+ connConfig: {
21
+ database,
22
+ user,
23
+ password,
24
+ port,
25
+ host
26
+ },
25
27
  log: 'debug'
26
28
  })
27
- const connection = await mysql.pool?.getConnection()
28
- connection?.release()
29
+ await mysql.init()
29
30
  models.length > 0 && (await mysql.table.create(models))
30
31
  } catch (error) {
31
32
  console.error('❌ 数据库连接失败:', error)
@@ -1,6 +1,5 @@
1
1
  /* eslint-disable no-var */
2
- import emysql from '@dpapejs/emysql'
3
- import eredis from '@/common/redis'
2
+ import emysql from '@aicblock/emysql'
4
3
  declare global {
5
4
  /**
6
5
  * mysql 服务