Skip to content

E-book web repository made in Node.js with MongoDB, supporting user register/edit, e-book upload/download and search.

License

Notifications You must be signed in to change notification settings

IBonato/eBooksIO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

eBooksIO

E-book web repository made in Node.js with MongoDB, supporting user register/edit, e-book upload/download and search.

Installation

  • Install Node.js

  • Install MongoDB

  • Install all dependencies from the package.json file in the current folder, in the Terminal type the following command (you need a package manager):

npm install
  • Create a folder in your local drive called data and another one inside it called db:
C:\data\db

Usage

  • Create the file db.js in the folder config with the following code:
if (process.env.NODE_ENV == "production") {
    module.exports = { mongoURI: "URL_to_your_Mongo_Server" }
}
else {
    module.exports = { mongoURI: "mongodb://user:pwd@localhost:27017/nameofthedatabase" } //Local URL to access via Browser
}
  • Start MongoDB, in the Terminal type the following command:
mongod
  • Create new database and admin:
mongo

use nameofthedatabase
db.createUser(
  {
    user: "myDatabaseAdmin",
    pwd: "abc123",
    roles: [ { role: "dbOwner", db: "nameofthedatabase" } ]
  }
)
  • Start the application (nodemon will automatically restart your application every time you make a change in any .js file and save it, if you don't have the package, you can install it globally with npm install -g nodemon):
nodemon app.js
  • Open localhost:8081 in your Browser.

License

MIT