Giter VIP home page Giter VIP logo

scaunifei's Introduction

SCAUNIFEI

File sharing system made in Node.js with MongoDB, supporting user register, edit and delete, file upload (by selected users) and download and search by multiple standards.

Installation

  • Install Node.js, the normal version already comes with NPM

  • 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") {
    //URL to your Cloud database
    module.exports = { mongoURI: "mongodb+srv://user:password@cluster_name.mongodb.net/database_name?retryWrites=true&w=majority" }
}
else {
    //Local URL to access via Browser (27017 is Mongo default connection PORT)
    module.exports = { mongoURI: "mongodb://user:password@localhost:27017/database_name" }
}
  • Start MongoDB, in the Terminal type the following command:
mongod
  • Create a new database and admin:
mongo

use nameofthedatabase
db.createUser(
  {
    user: "myDatabaseAdmin",
    pwd: "abc123",
    roles: [ { role: "dbOwner", db: "nameofthedatabase" } ]
  }
)
  • Create the files drive_key.json and gmail_key.json in the folder config/google containing the data for authentication with Google APIs, or set it with a .env file like the following:
# GMail OAuth2 API information
OAUTH_CLIENT_ID_GMAIL = CLIENT_ID
OAUTH_SECRET_GMAIL = SECRET
GMAIL_REFRESH_TOKEN = TOKEN
# Service account
OAUTH_SERVICE_ID_GMAIL = SERVICE_ID
OAUTH_SERVICE_PRIVATE_KEY_GMAIL = -----BEGIN PRIVATE KEY-----\n KEY \n-----END PRIVATE KEY-----\n

# GDrive OAuth2 API information
OAUTH_CLIENT_ID_DRIVE = CLIENT_ID
OAUTH_SECRET_DRIVE = SECRET
DRIVE_REFRESH_TOKEN = TOKEN
# Service account
OAUTH_SERVICE_ID_GMAIL = SERVICE_ID
OAUTH_SERVICE_PRIVATE_KEY_GMAIL = -----BEGIN PRIVATE KEY-----\n KEY \n-----END PRIVATE KEY-----\n
  • Start the application in another terminal window (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 on your computer with npm install -g nodemon):
nodemon app.js
  • Open localhost:8081 in your Browser and have fun!

License

MIT

scaunifei's People

Contributors

dependabot[bot] avatar ibonato avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.