Hello World!
jkchao / blog-service Goto Github PK
View Code? Open in Web Editor NEWblog service @nestjs
blog service @nestjs
Hello World!
[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 解析命名路径时会引发 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 });
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 });
原因是 package.json 中的 dev 脚本 把 ts-node 两边的单引号去掉就好了
你好
(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)
/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)
MongoDB 3.6
with mongoose 4.11.x
所有涉及aggregate
操作都失败如getTag
、updateArticleCommentCount
升级至mongoose 4.13.9
成功
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.