1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-09 07:20:05 +00:00

chore: docker bind mount + sasjs/cli in container

This commit is contained in:
Saad Jutt
2021-11-17 07:49:42 +05:00
parent 455367f10a
commit 3c328dbab2
15 changed files with 197 additions and 62 deletions

View File

@@ -1,5 +1,4 @@
import express from 'express'
import mongoose from 'mongoose'
import { AuthController } from '../../controllers/'
import Client from '../../model/Client'
@@ -28,32 +27,6 @@ export const populateClients = async () => {
})
}
export const connectDB = async () => {
const { MODE } = process.env
if (MODE?.trim() !== 'server') {
console.log('Running in Destop Mode, no DB to connect.')
const { sasLoc, driveLoc } = await getDesktopFields()
process.sasLoc = sasLoc
process.driveLoc = driveLoc
return
}
// NOTE: when exporting app.js as agent for supertest
// we should exlcude connecting to the real database
if (process.env.NODE_ENV !== 'test') {
mongoose.connect(process.env.DB_CONNECT as string, async (err) => {
if (err) throw err
console.log('Connected to db!')
await populateClients()
})
}
}
authRouter.post('/authorize', async (req, res) => {
const { error, value: body } = authorizeValidation(req.body)
if (error) return res.status(400).send(error.details[0].message)

View File

@@ -37,8 +37,8 @@ stpRouter.post(
try {
const response = await controller.executeReturnJson(
req,
query,
body?._program
body,
query?._program
)
res.send(response)
} catch (err: any) {