Last active
February 25, 2021 11:14
-
-
Save masahirompp/6cfdfd1e007187e61310 to your computer and use it in GitHub Desktop.
typescript + mongoose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../typings/tsd.d.ts" /> | |
import mongoose = require('mongoose'); | |
import AuthorDocumentModel = require('./AuthorDocumentModel'); | |
import IAuthorDocumentModel = require('./IAuthorDocumentModel'); | |
class db { | |
public static connect(db:string) { | |
mongoose.connect('mongodb://' + db); | |
} | |
public static debug(debug:any) { | |
mongoose.set('debug', debug); | |
} | |
static get Author():IAuthorDocumentModel { | |
return <IAuthorDocumentModel>AuthorDocumentModel; | |
} | |
} | |
export = db; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment