GithubHelp home page GithubHelp logo

jkchao / blog-service Goto Github PK

View Code? Open in Web Editor NEW
215.0 215.0 50.0 5.37 MB

blog service @nestjs

TypeScript 96.91% JavaScript 2.89% Dockerfile 0.20%
api api-server codecov express graphql graphql-server jest koa koa2 mongodb mongoose nestjs node redis travis-ci typescript

blog-service's Introduction

Hello World!

blog-service's People

Contributors

jkchao 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

blog-service's Issues

这是什么错误, 没连上数据库吗?

[email protected] dev F:\project\vue\blog-service-nest

cross-env NODE_ENV=dev nodemon --exec 'ts-node' ./src/main.ts

[nodemon] 1.18.4
[nodemon] to restart at any time, enter rs
[nodemon] watching: F:\project\vue\blog-service-nest\src/**/*
[nodemon] starting ts-node ./src/main.ts
[2018-10-18T10:13:19.721] [INFO] BLOG_SERVICE: APP - Starting Nest application...
[2018-10-18T10:13:20.138] [INFO] BLOG_SERVICE: APP - AppModule dependencies initialized
[2018-10-18T10:13:20.139] [INFO] BLOG_SERVICE: APP - MongooseModule dependencies initialized
[2018-10-18T10:13:20.139] [INFO] BLOG_SERVICE: APP - HttpModule dependencies initialized
[2018-10-18T10:13:20.140] [INFO] BLOG_SERVICE: APP - CacheModule dependencies initialized
(node:11008) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
[Nest] 11008 - 2018-10-18 10:13:20 [MongooseModule] Unable to connect to the database. Retrying (1)...
[Nest] 11008 - 2018-10-18 10:13:23 [MongooseModule] Unable to connect to the database. Retrying (2)... +3019ms
[Nest] 11008 - 2018-10-18 10:13:26 [MongooseModule] Unable to connect to the database. Retrying (3)... +3011ms
[Nest] 11008 - 2018-10-18 10:13:29 [MongooseModule] Unable to connect to the database. Retrying (4)... +3011ms
[Nest] 11008 - 2018-10-18 10:13:32 [MongooseModule] Unable to connect to the database. Retrying (5)... +3011ms
[Nest] 11008 - 2018-10-18 10:13:35 [MongooseModule] Unable to connect to the database. Retrying (6)... +3009ms
[Nest] 11008 - 2018-10-18 10:13:38 [MongooseModule] Unable to connect to the database. Retrying (7)... +3011ms
[Nest] 11008 - 2018-10-18 10:13:41 [MongooseModule] Unable to connect to the database. Retrying (8)... +3011ms
[Nest] 11008 - 2018-10-18 10:13:44 [MongooseModule] Unable to connect to the database. Retrying (9)... +3016ms
[2018-10-18T10:13:44.596] [ERROR] BLOG_SERVICE: APP - Authentication failed.
1: std::vector<v8::CpuProfileDeoptFrame,std::allocatorv8::CpuProfileDeoptFrame >::vector<v8::CpuProfileDeoptFrame,std::allocatorv8::CpuProfileDeoptFrame >
2: v8::internal::CompilerDispatcherTracer::Estimate
3: v8::internal::CompilerDispatcher::RemoveJob
4: v8::internal::CompilerDispatcher::RemoveJob
5: v8::internal::CompilerDispatcher::RemoveJob
6: 000002E9DDC047A1
[nodemon] app crashed - waiting for file changes before starting...

tsconfig-paths/register 解析路径时引发额外问题

问题源头

使用 tsconfig-paths/register 解析命名路径时会引发 graphql 编译错误.

# error
ts-node -r tsconfig-paths/register src/service.ts

# graphql 不报编译问题但是无法处理命名路径
ts-node -r src/service.ts

错误报告

TypeError: graphql_1.parse is not a function
    at Object.<anonymous> (D:\Project\web\blog-service\node_modules\graphql-tools\src\stitching\introspectSchema.ts:7:48)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\Code\nodejs\node_global\node_modules\ts-node\src\index.ts:485:14)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (D:\Project\web\blog-service\node_modules\graphql-tools\src\stitching\index.ts:2:1)

源码

// src/server.ts
import Koa from "koa";

import server from "./graphql";

const app = new Koa();

server.applyMiddleware({ app });
src/graphql/index.ts
import { ApolloServer, gql } from "apollo-server-koa";

const typeDefs = gql`
  # Comments in GraphQL strings (such as this one) start with the hash (#) symbol.

  # This "Book" type defines the queryable fields for every book in our data source.
  type Book {
    title: String
    author: String
  }

  # The "Query" type is special: it lists all of the available queries that
  # clients can execute, along with the return type for each. In this
  # case, the "books" query returns an array of zero or more Books (defined above).
  type Query {
    books: [Book]
  }
`;

const books = [
  {
    title: "Harry Potter and the Chamber of Secrets",
    author: "J.K. Rowling"
  },
  {
    title: "Jurassic Park",
    author: "Michael Crichton"
  }
];

// Resolvers define the technique for fetching the types defined in the
// schema. This resolver retrieves books from the "books" array above.
const resolvers = {
  Query: {
    books: () => books
  }
};

// The ApolloServer constructor requires two parameters: your schema
// definition and your set of resolvers.
export default new ApolloServer({ typeDefs, resolvers });

mongo 连接报错

你好

image

(node:88141) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect.
(node:88141) UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [127.0.0.1:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) {
name: 'MongoNetworkError',
errorLabels: [Array],
[Symbol(mongoErrorContextSymbol)]: {}
}]
at Pool. (/Users/mac/Desktop/film/blog-service/node_modules/mongodb-core/lib/topologies/server.js:564:11)

尝试加了 也不行
image

这是什么错误?

/Downloads/node-koa-master/src/error/ColumnTypeUndefinedError.ts:9 super(); ^ ColumnTypeUndefinedError: Column type for Tag#name is not defined and cannot be guessed. Make sure you have turned on an "emitDecoratorMetadata": true option in tsconfig.json. Also make sure you have imported "reflect-metadata" on top of the main entry file in your application (before any entity imported).If you are using JavaScript instead of TypeScript you must explicitly provide a column type. at new ColumnTypeUndefinedError (/Users/yuanpan/Downloads/node-koa-master/src/error/ColumnTypeUndefinedError.ts:9:9) at /Users/yuanpan/Downloads/node-koa-master/src/decorator/columns/Column.ts:119:23 at DecorateProperty (/Users/yuanpan/Downloads/node-koa-master/node_modules/reflect-metadata/Reflect.ts:1214:35) at Object.decorate (/Users/yuanpan/Downloads/node-koa-master/node_modules/reflect-metadata/Reflect.ts:737:24) at __decorate (/Users/yuanpan/Downloads/node-koa-master/src/model/tag.ts:9:92) at Object.<anonymous> (/Users/yuanpan/Downloads/node-koa-master/src/model/tag.ts:21:3) at Module._compile (internal/modules/cjs/loader.js:702:30) at Module.m._compile (/Users/yuanpan/Downloads/node-koa-master/node_modules/ts-node/src/index.ts:400:23) at Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Object.require.extensions.(anonymous function) [as .ts] (/Users/yuanpan/Downloads/node-koa-master/node_modules/ts-node/src/index.ts:403:12) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12) at Function.Module._load (internal/modules/cjs/loader.js:543:3) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object.<anonymous> (/Users/yuanpan/Downloads/node-koa-master/src/controller/tag.ts:10:1) at Module._compile (internal/modules/cjs/loader.js:702:30) at Module.m._compile (/Users/yuanpan/Downloads/node-koa-master/node_modules/ts-node/src/index.ts:400:23) at Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Object.require.extensions.(anonymous function) [as .ts] (/Users/yuanpan/Downloads/node-koa-master/node_modules/ts-node/src/index.ts:403:12) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12)

建议升级mongoose版本

MongoDB 3.6 with mongoose 4.11.x
所有涉及aggregate操作都失败如getTagupdateArticleCommentCount
升级至mongoose 4.13.9成功

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.