Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions api/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ app.get('/testWasm', (req, res) => {
})

app.use('/users', userRouter);
app.use('/device', deviceRouter);
app.use('/devices', deviceRouter);

app.listen(4000, function () {
app.listen(3000, function () {
console.log('server started')
});
14 changes: 6 additions & 8 deletions api/dbOperations.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
const mongoose = require('mongoose')

const hostName = "mongo";
const hostName = "mongo"; //If running locally, hostName should be changed to "localhost", and "mongo" if in docker.
const port = "27017";
const dbName = 'beiss';

const dbUrl = `mongodb://${hostName}:${port}/${dbName}`;

async function dbStart(){
await mongoose.connect(dbUrl).then(r => {
console.log("db connection status: " + r);
// have your mongo running in local terminal :27017
})
}
mongoose.connect(dbUrl).then(res => {
console.log("db connection status: " + res);
})


const deviceSchema = mongoose.Schema({
id: String
Expand All @@ -25,4 +23,4 @@ const userSchema = mongoose.Schema({
const Device = mongoose.model('Device', deviceSchema);
const User = mongoose.model('User', userSchema);

module.exports = { dbStart, Device, User }
module.exports = { Device, User }
Loading