3KLES Core MongoDB
npm install @3kles/3kles-coremongodbThis package contains interface and class to create MongoDB Application
MongoDBApp is a class that extends GenericApp from @3kles/3kles-corebe:
- urlmongodb: Set url to MongoDB
- option: Set connect options for mongoose
MongoDBRouter is a class to create a MongoDB router from a GenericRouter from @3kles/3kles-corebe
MongoDBController is a class to create a MongoDBController that extends from AbstractGenericController from @3kles/3kles-corebe
- model: Define the model of document we store
MongoDBService is a service that extends from AbstractGenericService from @3kles/3kles-corebe to do CRUD operations
```
npm install @3kles/3kles-coremongodb --save
How to create an app
`javascript
const port = 30000;
const httpjsonapi: HttpApi = new HttpApi();
httpjsonapi.setResponseParser(new JSONParser());
httpjsonapi.setErrorParser(new JSONParser());
const documents = app.getMongoose().model
app.addRoute(new MongoDBRouter(new MongoDBController(new MongoDBService(documents, httpjsonapi))).router);
app.initRoute();
app.startApp(port);
`
Check the documentation` here.