GithubHelp home page GithubHelp logo

surmon-china / nodepress Goto Github PK

View Code? Open in Web Editor NEW
1.4K 26.0 294.0 46.19 MB

🟢 RESTful API service for https://surmon.me blog, powered by @nestjs

Home Page: https://github.surmon.me/nodepress

License: MIT License

TypeScript 99.12% JavaScript 0.35% Shell 0.53%
blog cms mongoose express mongodb restful-api nodejs node-js jwt-token cms-framework

nodepress's Introduction

👋    Hello World! I am Surmon.

> I am passionate ❤️‍🔥 about open source software and giving back to others.

> My projects are trusted 💕 by thousands of developers all over the world.

_

total GitHub stars    total NPM downloads

blog   LinkedIn   LeetCode   Instagram   Twitter   YouTube   Telegram   Discord

Become a sponsor to me on GitHub Sponsors or PayPal, BTC,ETH.

GitHub Top Languages

  project homepage stars last commit downloads version
README.vue #homepage GitHub stars GitHub last commit - GitHub package version
veact  |  veact-use 🔥 #readme GitHub stars GitHub last commit NPM downloads GitHub package version
mongodb-data-api - GitHub stars GitHub last commit NPM downloads GitHub package version
libundler - GitHub stars GitHub last commit NPM downloads GitHub package version
nodepress 🔥 #documentation GitHub stars GitHub last commit - GitHub package version
surmon.me 🔥 #surmon.me GitHub stars GitHub last commit - GitHub package version
veact-admin #demo_site GitHub stars GitHub last commit - GitHub package version
angular-admin - GitHub stars GitHub last commit - GitHub package version
surmon.me.native #download GitHub stars GitHub last commit - GitHub package version
naivebayes #examples GitHub stars GitHub last commit NPM downloads GitHub package version
🎬 videojs-player #examples GitHub stars GitHub last commit NPM downloads -
vue-awesome-swiper #examples GitHub stars GitHub last commit NPM downloads GitHub package version
vue-codemirror #examples GitHub stars GitHub last commit NPM downloads GitHub package version
vue-quill-editor #examples GitHub stars GitHub last commit NPM downloads GitHub package version
vue-touch-ripple #examples GitHub stars GitHub last commit NPM downloads GitHub package version
vue-drag-zone #examples GitHub stars GitHub last commit NPM downloads GitHub package version
ngx-quill-editor #examples GitHub stars GitHub last commit NPM downloads GitHub package version
typed-less-modules - GitHub stars GitHub last commit NPM downloads GitHub package version
wonderful-bing-wallpaper - GitHub stars GitHub last commit NPM downloads GitHub package version
simple-netease-cloud-music - GitHub stars GitHub last commit NPM downloads GitHub package version
🤪 emoji-233333 #examples GitHub stars GitHub last commit NPM downloads GitHub package version
better-itg-flat-dark-vscode-theme #install GitHub stars GitHub last commit - -
github.surmon.me - GitHub stars GitHub last commit - GitHub package version
create-release #marketplace GitHub stars GitHub last commit - GitHub package version
WordPress themes - - - - -

nodepress's People

Contributors

dependabot[bot] avatar sinchang avatar surmon-china avatar torvaldssg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nodepress's Issues

本地dev编译问题

node_modules/mongodb/mongodb.d.ts:3309:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.
Type 'void' is not assignable to type 'this'.
'this' could be instantiated with an arbitrary type which could be unrelated to 'void'.

3309 end(): void;
~~~

node_modules/mongodb/mongodb.d.ts:3310:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.

3310 end(chunk: Buffer): void;
~~~

node_modules/mongodb/mongodb.d.ts:3311:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.

3311 end(callback: Callback<GridFSFile | void>): void;
~~~

node_modules/mongodb/mongodb.d.ts:3312:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.

3312 end(chunk: Buffer, callback: Callback<GridFSFile | void>): void;
~~~

node_modules/mongodb/mongodb.d.ts:3313:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.

3313 end(chunk: Buffer, encoding: BufferEncoding): void;
~~~

node_modules/mongodb/mongodb.d.ts:3314:5 - error TS2416: Property 'end' in type 'GridFSBucketWriteStream' is not assignable to the same property in base type 'Writable'.
Type '{ (): void; (chunk: Buffer): void; (callback: Callback<void | GridFSFile>): void; (chunk: Buffer, callback: Callback<void | GridFSFile>):
void; (chunk: Buffer, encoding: BufferEncoding): void; (chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<...>): void; }' is not assignable to type '{ (cb?: (() => void) | undefined): this; (chunk: any, cb?: (() => void) | undefined): this; (chunk: any, encoding: BufferEncoding, cb?: (() => void) | undefined): this; }'.

3314 end(chunk: Buffer, encoding: BufferEncoding | undefined, callback: Callback<GridFSFile | void>): void;

src/processors/helper/helper.service.akismet.ts:34:19 - error TS2709: Cannot use namespace 'akismet' as a type.

34 private client: akismet
~~~~~~~

src/processors/helper/helper.service.akismet.ts:44:27 - error TS2339: Property 'client' does not exist on type 'typeof import("akismet-api")'. smet-api")'.

44 this.client = akismet.client({
~~~~~~

百度seo 报错400 over quota

你好,自己的应用借鉴了你的很多代码,在做百度seo时,推送是成功的,而更新和删除是失败的,请问您是否有这方面的经验
2018-11-15 3 07 12

感谢您的开源

关于开源协议

自己也想建一个博客,在github上搜索到这个项目。感觉功能和代码都很赞,想fork之后直接投入使用(可能会做一些修改),但没有看到相关开源协议,就开个issues询问一下是否可以。

jwt续签问题

作者您好,阅读了您的代码有了,但是发现jwt好像没有做续签,不知道是不是我没有找到相关位置。

加swagger 编译报错

你好我发现用了你的http.decorator.ts然后再加swagger编译报错,
具体报什么错也没有提示,只是编译界面直接显示Error

请问能出一个简易教程吗?

感谢作者大大的付出,谢谢。
本人目前主要从事前端方面的工作,但是对后端也很感兴趣,前段时间仔细看了看egg.js和koa这些框架,但是没怎么整明白,一些helloworld可以跑起来,但是像大佬这种就不行了,所以希望大佬出一个简易教程,我想先让它跑起来,然后再仔细琢磨。
万分感谢。

model里的pre钩子只有save

model里的pre钩子只有save,少了update吧,不然更新的时候没有触发更新update_time的,而且我这边更新update_time是用的this.update({...})方法,直接用this.update_time = ...不起作用

全局异常过滤器报错

@Catch()
export class HttpExceptionFilter implements ExceptionFilter {
  // ...
  const status = exception.getStatus() || HttpStatus.INTERNAL_SERVER_ERROR;
  // ...
}

这里@catch()是否应该改为@catch(HttpException)

其它类型的异常对象可能没有getStatus方法,从而导致全局过滤器报错。

yarn start:prod出现以下报错

[error] [nodepress] (node:88584) UnhandledPromiseRejectionWarning: Error: ENOENT: n
o such file or directory, open 'E:\Study\surmon.me\public\sitemap.xml'
at Object.openSync (fs.js:457:3)
at Object.writeFileSync (fs.js:1282:35)
at E:\Study\nodepress-master\dist\modules\syndication\syndication.service.js:192
:30
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
[error] [nodepress] (node:88584) UnhandledPromiseRejectionWarning: Unhandled promis
e rejection. This error originated either by throwing inside of an async function wi
thout a catch block, or by rejecting a promise which was not handled with .catch().
To terminate the node process on unhandled promise rejection, use the CLI flag --un handled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_reject
ions_mode). (rejection id: 1)
[error] [nodepress] (node:88584) [DEP0018] DeprecationWarning: Unhandled promise re
jections are deprecated. In the future, promise rejections that are not handled will
terminate the Node.js process with a non-zero exit code.
[warn] [nodepress] 邮件客户端初始化连接失败!将在半小时后重试: Invalid login: 535
Login Fail. Please enter your authorization code to login. More information in http:
//service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256
[warn] [nodepress] Akismet 验证失败!无法工作,原因: Akismet Key 无效!

该如何解决呢?

Node Gyp 问题

hi

yarn 一直出现Gyp 的问题
gyp ERR! find VS msvs_version was set from command line or npm config
gyp ERR! find VS - looking for Visual Studio version 2015

多数关于 Vs , 是一定要用 visual studio 才能运行吗? 应该不是吧?

Linux下npm run start:prod编译报错

NODE_ENV=production rimraf dist && tsc

src/decorators/query-params.decorator.ts:89:25 - error TS2538: Type 'ITransformConfigObject' cannot be used as an index type.

89 transformConfig[field] = true;
~~~~~

src/modules/category/category.service.ts:145:65 - error TS2339: Property '_id' does not exist on type 'unknown'.

145 .find({ _id: { $in: Array.from(categories, c => c._id) }})
~~~

Found 2 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] prestart:prod: NODE_ENV=production rimraf dist && tsc
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] prestart:prod script.


在本地测试全部正常

关于[数据流异常拦截器]的疑问

你好,从你的开源代码中学到很多,非常感谢!

数据流异常拦截器按照 README 的描述是:当控制器所需的 Promise service 发生错误时,错误将在此被捕获

有两个个疑问:

  1. 该拦截器只是收集了错误信息并抛出异常(CustomException),仅仅是这样的需求的话,为什么不直接通过过滤器(HttpExceptionFilter)捕获错误呢?因为拦截器抛出的异常(CustomException)最终依然是交给过滤器(HttpExceptionFilter)来处理,而过滤器的第一个参数 exception 是有完整的错误信息的
  2. 该拦截器中抛出异常的代码是 throwError(new CustomException({ message, error }, statusCode));,这样的写法会导致在终端中打印出 抛出异常的无效堆栈信息
    image,并没有记录实质的请求相关的内容

我在生产环境中并没有关闭 NestJS Logger,所以我在 HttpExceptionFilter 中多加了些打印日志

Logger.error(
  `${request.method} ${request.url}`,
  JSON.stringify(errorResponse),
  'HttpExceptionFilter',
);

image

npm install error : 依赖的包(mongoose-paginate.git)不存在

npm install error : 依赖的包(ssh://github.com/surmon-china/mongoose-paginate.git)不存在

i@mingbai:~/node/nodepress$ npm install
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://[email protected]/surmon-china/mongoose-paginate.git
npm ERR! 
npm ERR! Permission denied (publickey).
npm ERR! fatal: 无法读取远程仓库。
npm ERR! 
npm ERR! 请确认您有正确的访问权限并且仓库存在。
npm ERR! 
npm ERR! exited with error code: 128

我查看了相应的git地址,好像没有这个项目。换成其他开源的同名项目,并且把ssh 协议改为http,可以正常运行,但是不知道这么改是否合适,也不太明白为什么会有ssh的依赖,故有此一问。

yarn run start:prod

$ cross-env NODE_ENV=production node -r ./tsconfig-paths-bootstrap.js dist/main.js
error Command failed with exit code 1.

程序直接退出了并没有运行成功 也没有排查错误信息的日志 能帮忙看下问题么

請問有沒有方法可以seed data?

請問有沒有方法可以seed data?

例如像 laravel 那樣有指令可進行 seed 匯入或 遷移轉換資料

或者可自訂指令來執行呢?

三个博客项目怎么跑起来?

作者您好,看到您关于博客的三个开源项目:前端、后端、后端管理这三个项目,想搭建跑起来学习一下,请问这三个项目怎么一起跑起来呢?比如nodepress这个项目,这个项目对应的数据我该如何建表或者库,有没有直接的sql可以使用?非常感谢

npm run dev 好像并没有运行启动程序

`D:\web\nodepress-master>cnpm run dev

[email protected] dev D:\web\nodepress-master
nodemon --exec "set NODE_ENV=development node --harmony

[nodemon] 1.11.0
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting set NODE_ENV=development node --harmo [nodemon] clean exit - waiting for changes before restart

这样是正常的吗? 我用的是WINDOW 。请指点

如何实现拦截器依赖注入?

我有一个需求, 想判断如果用户jwt满足刷新条件(比如生成超过1天且未过期)就在接口返回中返回一个新的token。
我能想到的做法是建立一个拦截器,判断并为返回结果加上新token。 可是拦截器似乎不支持依赖注入,就没法获得必须的模块(缓存和用户服务)。
有什么好建议么😯

遇到一个ts编译问题,排查了好久,记录一下,给后来者遇到的人

[email protected] start:dev /Applications/MAMP/htdocs/nodepress
NODE_ENV=development nodemon

[nodemon] 1.18.7
[nodemon] to restart at any time, enter rs
[nodemon] watching: /Applications/MAMP/htdocs/nodepress/src/**/*
[nodemon] starting ts-node -r tsconfig-paths/register src/main.ts

/Applications/MAMP/htdocs/nodepress/node_modules/ts-node/src/index.ts:261
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/modules/expansion/expansion.service.qiniu.ts(24,42): error TS2345: Argument of type 'unknown' is not assignable to parameter of type 'string'.
src/modules/expansion/expansion.service.qiniu.ts(25,47): error TS2322: Type 'unknown' is not assignable to type 'string'.

是需要配七牛的配置app.config.ts

export const QINIU = {
accessKey: argv.qn_accessKey || 'your access key',
secretKey: argv.qn_secretKey || 'your secret key',
bucket: argv.qn_bucket || 'nodepress',
origin: argv.qn_origin || 'http://nodepress.u.qiniudn.com',
uploadURL: argv.qn_uploadURL || 'http://up.qiniu.com/',
};

找不到rss.xml

[error] [nodepress] (node:10300) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open '/Users/geekchief/Desktop/Work/Workspace/Geekkampong/gm/surmon.me/public/rss.xml'
    at Object.openSync (fs.js:476:3)
    at Object.writeFileSync (fs.js:1467:35)
    at /Users/geekchief/Desktop/Work/Workspace/Geekkampong/gm/blog-api/dist/modules/syndication/syndication.service.js:198:30
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async Promise.all (index 1)

yarn start后,报这个错误,rss.xml怎么编写?有没有样例,需要帮助,感谢感谢!

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.