Fixed api endpoints
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 54s
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 54s
This commit is contained in:
@@ -7,6 +7,7 @@ const path = require('path');
|
||||
const dotenv = require('dotenv');
|
||||
|
||||
if(process.env.NODE_ENV) {
|
||||
console.log(`.env.${process.env.NODE_ENV}`);
|
||||
dotenv.config({
|
||||
path: `.env.${process.env.NODE_ENV}`
|
||||
});
|
||||
@@ -20,7 +21,7 @@ const connectDB = require("./db");
|
||||
|
||||
// PUBLIC
|
||||
const uploadDir = path.join(__dirname, 'uploads');
|
||||
app.use('/public', express.static(uploadDir));
|
||||
app.use('/api/public', express.static(uploadDir));
|
||||
|
||||
// JSON LIMIT EXPRESS
|
||||
app.use(express.json({ limit: '50mb' }));
|
||||
@@ -45,15 +46,15 @@ app.use(cors({
|
||||
}));
|
||||
|
||||
// ROUTES (NO AUTH)
|
||||
app.use('/user', require('./routes/user'));
|
||||
app.use('/api/user', require('./routes/user'));
|
||||
|
||||
// AUTH
|
||||
checkAuth = passport.authenticate('jwt', { session: false });
|
||||
app.use(checkAuth);
|
||||
|
||||
// ROUTES WITH AUTH
|
||||
app.use('/campaign', require('./routes/campaign'));
|
||||
app.use('/note', require('./routes/note'));
|
||||
app.use('/api/campaign', require('./routes/campaign'));
|
||||
app.use('/api/note', require('./routes/note'));
|
||||
/*
|
||||
app.use('/campaign', require('./routes/campaign'));
|
||||
app.use('/maps', require('./routes/map'));
|
||||
|
||||
@@ -21,7 +21,7 @@ function retrieveAvatar(){
|
||||
Server().get('/user/retrieve-avatar?username=' + GetUser().username)
|
||||
.then((response) => {
|
||||
if(response.data.image){
|
||||
const imgUrl = backendUrl + "public/" + response.data.image;
|
||||
const imgUrl = backendUrl + "/public/" + response.data.image;
|
||||
|
||||
// Wait for the image to fully load
|
||||
const img = new Image();
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
const config = useRuntimeConfig()
|
||||
const backendUrl = config.public.apiBaseUrl
|
||||
const backendUrl = process.env.API_BASE_URL || 'http://localhost:5000/api'
|
||||
|
||||
export {
|
||||
backendUrl
|
||||
|
||||
Reference in New Issue
Block a user