mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
backend: generating guests
This commit is contained in:
parent
b6bd300e1b
commit
5025a43dbd
16 changed files with 1380 additions and 167 deletions
28
backend/config/db.js
Normal file
28
backend/config/db.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const user = 'user';
|
||||
const password = 'password';
|
||||
const hostname = 'vault48.org';
|
||||
const port = 27017;
|
||||
const db = 'map';
|
||||
|
||||
const mongoose = require('mongoose');
|
||||
mongoose.Promise = require('bluebird');
|
||||
|
||||
mongoose.connect(`mongodb://${user}:${password}@${hostname}:${port}/${db}`, { });
|
||||
const database = mongoose.connection;
|
||||
|
||||
database.on('error', (err) => { console.error(`Database Connection Error: ${err}`); process.exit(2); });
|
||||
database.on('connected', () => { console.info('Succesfully connected to MongoDB Database'); });
|
||||
|
||||
const Schema = mongoose.Schema;
|
||||
|
||||
// Schemas
|
||||
const User = new Schema({
|
||||
id: { type: String, required: true },
|
||||
role: { type: String, required: true },
|
||||
token: { type: String, required: true },
|
||||
});
|
||||
|
||||
|
||||
const UserModel = mongoose.model('User', User);
|
||||
|
||||
module.exports.UserModel = UserModel;
|
Loading…
Add table
Add a link
Reference in a new issue