Hello everybody!First of all I'm sorry for my english, it's not my native language. Second I'm not sure if this is the right sub for this question, but maybe someone can direct me to the right sub for this.Now my problem: I am learning some Javascript/Node, and I wanted to create an API with the Swagger and the KOA-Framework. My problem is I can't write anything on my local database. It won't create the database. I thought that with the code:const mongooseOptions = { useCreateIndex: true, useNewUrlParser: true, }; Mongoose.connect('mongodb://localhost:27017/book_example', mongooseOptions, function(error){ console.log("connection successful"); }); it will automatically create a db on my computer, but it does nothing. I launch my mongodb server with: sudo service mongod start and I launch my program with nodemon.jsThe goal is, that first of all I can write something in my db. Is my attempt wrong? Or should i manually create first a folder in my Mongodb-folder?Here is the link to the github-repo: Project-Example. If launch all this, the API will run on http://localhost:3000/docHopefully someone can help, or give me some hints about this
Submitted April 18, 2019 at 07:46PM by HQ189
No comments:
Post a Comment