注册账号登录
关注

api没有任何验证吗

小度鱼问题反馈创建于4月28日53次阅读

api可以直接调用的吗
//img.xiaoduyu.com/53f5c5610e4b48bcbac3cbc8e92cd728.png

//img.xiaoduyu.com/4245dbbe0c6e41c1a8cba661904bf12c.png

2条评论 / 12条回复
还有一个问题想问一下,这个时间乱序,是单独做的推荐吗?还是bug



回复
帖子排序是根据回复日期排序和创建日期规则排序。
4月28日
回复
API是开放调用的。
回复
哈哈哈,我的问题太多了,还有一个
ssl证书是单独使用nginx做的吗?web、api、admin、这些
4月28日
回复
web、api、qiniu cdn需要,admin一般自己访问,所以http就可以了。
4月28日
回复
自动用nginx代理一下就可以了是吗
4月28日
回复
还有我这里打包api的时候会报这个错误,测试的时候没问题,debug也已经关了
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ sudo npm run dist

> xiaoduyu-api@2.4.0 dist /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
> tsc

node_modules/@types/node/index.d.ts:201:11 - error TS2300: Duplicate identifier 'IteratorResult'.

201 interface IteratorResult<T> { }
              ~~~~~~~~~~~~~~

  ../../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.

../../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.

41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
        ~~~~~~~~~~~~~~

  node_modules/@types/node/index.d.ts:201:11
    201 interface IteratorResult<T> { }
                  ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! xiaoduyu-api@2.4.0 dist: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the xiaoduyu-api@2.4.0 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wyp/.npm/_logs/2020-04-28T05_17_46_151Z-debug.log
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ cat /Users/wyp/.npm/_logs/2020-04-28T05_17_46_151Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dist' ]
2 info using npm@6.13.4
3 info using node@v12.14.1
4 verbose run-script [ 'predist', 'dist', 'postdist' ]
5 info lifecycle xiaoduyu-api@2.4.0~predist: xiaoduyu-api@2.4.0
6 info lifecycle xiaoduyu-api@2.4.0~dist: xiaoduyu-api@2.4.0
7 verbose lifecycle xiaoduyu-api@2.4.0~dist: unsafe-perm in lifecycle true
8 verbose lifecycle xiaoduyu-api@2.4.0~dist: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com/node_modules/.bin:/Users/wyp/opt/anaconda3/bin:/Users/wyp/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
9 verbose lifecycle xiaoduyu-api@2.4.0~dist: CWD: /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
10 silly lifecycle xiaoduyu-api@2.4.0~dist: Args: [ '-c', 'tsc' ]
11 silly lifecycle xiaoduyu-api@2.4.0~dist: Returned: code: 2 signal: null
12 info lifecycle xiaoduyu-api@2.4.0~dist: Failed to exec dist script
13 verbose stack Error: xiaoduyu-api@2.4.0 dist: `tsc`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:223:5)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:223:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid xiaoduyu-api@2.4.0
15 verbose cwd /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist"
18 verbose node v12.14.1
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 2
22 error xiaoduyu-api@2.4.0 dist: `tsc`
22 error Exit status 2
23 error Failed at the xiaoduyu-api@2.4.0 dist script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ node server.js
internal/modules/cjs/loader.js:796
    throw err;
    ^

Error: Cannot find module '/Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com/server.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:793:17)
    at Function.Module._load (internal/modules/cjs/loader.js:686:27)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ npm run dev

> xiaoduyu-api@2.4.0 dev /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
> cross-env NODE_ENV=development supervisor node ./dist/src/index.js


Running node-supervisor with
  program './dist/src/index.js'
  --watch '.'
  --extensions 'node,js'
  --exec 'node'

Starting child process with 'node ./dist/src/index.js'
Watching directory '/Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com' for changes.
Press rs for restarting the process.
server started on port 3000
GET / 200 18.532 ms - 669
GET /favicon.ico 404 1.823 ms - 13
GET /graphql 200 9.801 ms - -
POST /graphql 200 278.675 ms - 165840
POST /graphql 200 48.940 ms - 165840
GET / 304 8.006 ms - -
4月28日
回复
应该是没有的tsc命令,npm install -g typescript 安装一下
4月28日
回复
测试了一下,还是报错,非常奇怪
是 typescript 版本有要求吗
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ sudo npm install -g typescript
Password:
/usr/local/bin/tsc -> /usr/local/lib/node_modules/typescript/bin/tsc
/usr/local/bin/tsserver -> /usr/local/lib/node_modules/typescript/bin/tsserver
+ typescript@3.8.3
updated 1 package in 5.142s
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ sudo npm install -g supervisor
/usr/local/bin/supervisor -> /usr/local/lib/node_modules/supervisor/lib/cli-wrapper.js
/usr/local/bin/node-supervisor -> /usr/local/lib/node_modules/supervisor/lib/cli-wrapper.js
+ supervisor@0.12.0
updated 1 package in 1.165s
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ sudo npm run dist

> xiaoduyu-api@2.4.0 dist /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
> tsc

node_modules/@types/node/index.d.ts:201:11 - error TS2300: Duplicate identifier 'IteratorResult'.

201 interface IteratorResult<T> { }
              ~~~~~~~~~~~~~~

  ../../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6
    41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
            ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.

../../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2015.iterable.d.ts:41:6 - error TS2300: Duplicate identifier 'IteratorResult'.

41 type IteratorResult<T, TReturn = any> = IteratorYieldResult<T> | IteratorReturnResult<TReturn>;
        ~~~~~~~~~~~~~~

  node_modules/@types/node/index.d.ts:201:11
    201 interface IteratorResult<T> { }
                  ~~~~~~~~~~~~~~
    'IteratorResult' was also declared here.


Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! xiaoduyu-api@2.4.0 dist: `tsc`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the xiaoduyu-api@2.4.0 dist script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wyp/.npm/_logs/2020-04-28T05_39_47_439Z-debug.log
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ cat /Users/wyp/.npm/_logs/2020-04-28T05_39_47_439Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dist' ]
2 info using npm@6.13.4
3 info using node@v12.14.1
4 verbose run-script [ 'predist', 'dist', 'postdist' ]
5 info lifecycle xiaoduyu-api@2.4.0~predist: xiaoduyu-api@2.4.0
6 info lifecycle xiaoduyu-api@2.4.0~dist: xiaoduyu-api@2.4.0
7 verbose lifecycle xiaoduyu-api@2.4.0~dist: unsafe-perm in lifecycle true
8 verbose lifecycle xiaoduyu-api@2.4.0~dist: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com/node_modules/.bin:/Users/wyp/opt/anaconda3/bin:/Users/wyp/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin
9 verbose lifecycle xiaoduyu-api@2.4.0~dist: CWD: /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
10 silly lifecycle xiaoduyu-api@2.4.0~dist: Args: [ '-c', 'tsc' ]
11 silly lifecycle xiaoduyu-api@2.4.0~dist: Returned: code: 2 signal: null
12 info lifecycle xiaoduyu-api@2.4.0~dist: Failed to exec dist script
13 verbose stack Error: xiaoduyu-api@2.4.0 dist: `tsc`
13 verbose stack Exit status 2
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:223:5)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:223:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid xiaoduyu-api@2.4.0
15 verbose cwd /Users/wyp/Desktop/git/xiaoduyu/api.xiaoduyu.com
16 verbose Darwin 18.7.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist"
18 verbose node v12.14.1
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 2
22 error xiaoduyu-api@2.4.0 dist: `tsc`
22 error Exit status 2
23 error Failed at the xiaoduyu-api@2.4.0 dist script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

4月28日
回复
试一试tsc -v 命令是否有效,或者删除node_modules,然后重新npm install试一试。
4月28日
回复
(base) appledeMacBook-Pro:api.xiaoduyu.com wyp$ tsc -v
Version 3.8.3

4月28日
回复
重新安装 node_modules 试一试吧,看错误是因为tsc的问题。
4月28日
回复
好的,我在试一下,感谢
4月28日
回复
还有 1 条评论
qingfengfenga
关注私信
1
关注
1
粉丝
4
帖子