Ramon
Ramon
WWasp-lang
Created by Ramon on 9/4/2024 in #đŸ™‹questions
Authenticated image download
Hi, I would like to implement a feature in OpenSaaS/WASP where users can publish some posts with images, but these posts should only be available to authenticated users (images shouldn't be public). I was thinking of using a WASP api, but then I cannot load images in React with a simple <img src="..."> tag. What would be your suggestion for implementing authenticated image download? This could probably be a nice default feature for opensaas. Thanks in advance!
10 replies
WWasp-lang
Created by Ramon on 8/12/2024 in #đŸ™‹questions
Infinite loop if updateCurrentUser returns void
No description
16 replies
WWasp-lang
Created by Ramon on 8/2/2024 in #đŸ™‹questions
HTTPS
Hey! I have enabled HTTPS using the following code: main.wasp file:
server: {
setupFn: import { initServer } from "@src/server/setup/initServer.js"
}
server: {
setupFn: import { initServer } from "@src/server/setup/initServer.js"
}
initServer.js file:
import { ServerSetupFn } from 'wasp/server'
import { Application } from 'express'
import https from 'https';
import fs from 'fs';

export const initServer: ServerSetupFn = async ({ app }) => {
addHttpsServer(app)
}

function addHttpsServer(app: Application) {

const options = {
key: fs.readFileSync('/etc/ssl/certs/myapp.key'),
cert: fs.readFileSync('/etc/ssl/certs/myapp.cert')
};

https.createServer(options, app).listen(3002, () => {
console.log('Server is running on port 3002 with HTTPS');
});
}
import { ServerSetupFn } from 'wasp/server'
import { Application } from 'express'
import https from 'https';
import fs from 'fs';

export const initServer: ServerSetupFn = async ({ app }) => {
addHttpsServer(app)
}

function addHttpsServer(app: Application) {

const options = {
key: fs.readFileSync('/etc/ssl/certs/myapp.key'),
cert: fs.readFileSync('/etc/ssl/certs/myapp.cert')
};

https.createServer(options, app).listen(3002, () => {
console.log('Server is running on port 3002 with HTTPS');
});
}
Hopefully it can help someone else and I can get some feedback. I then configured my DNS provider to redirect from HTTP to HTTPS. Do you think this is secure enough and the best approach for the current version of WASP? Thank you!
6 replies