Skip to content

Mongod is not a constructor #3

@xndyz

Description

@xndyz

Looks like the module is not working. When I do:

import * as Koa from 'koa'
import * as Router from 'koa-router'
import * as next from 'next'
import * as mongoose from 'mongoose'
import Mongod from 'mongod'

const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev })
const handle = app.getRequestHandler()

app.prepare()
.then(async () => {
  await new Mongod(27017).open()
  mongoose.connect('mongodb://localhost:27017/local')

I get this error:

(node:59616) UnhandledPromiseRejectionWarning: TypeError: mongod_1.Mongod is not a constructor
    at app.prepare.then (/Users/fang/Documents/community/server/index.ts:14:5)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
(node:59616) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without
 a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:59616) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will term
inate the Node.js process with a non-zero exit code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions