Jake
WWasp-lang
•Created by Jake on 3/15/2024 in #đŸ™‹questions
ngrok...
I got a bunch of errors... i am on a mac.
ngrok http 3000
ngrok http 3001
-> this URL set to REACT_APP_API_URL
access the URL got from 3000. Here are the errors I see in my browser console.
[Error] WebSocket connection to 'wss://0dc1-76-93-181-125.ngrok-free.app/' failed: WebSocket is closed due to suspension.
[Error] Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ["auth/me"]
onSuccess (@tanstack_react-query.js:1020)
resolve (@tanstack_react-query.js:603)
3001 server console:
OPTIONS /auth/me 204 No Content
OPTIONS /auth/me 204 No Content
OPTIONS /auth/me 204 No Content
OPTIONS /auth/me 204 No Content
OPTIONS /auth/username/login 204 No Content
POST /auth/username/login 200 OK <- this one when i directly went to url/login
OPTIONS /auth/me 204 No Content
OPTIONS /auth/me 204 No Content
OPTIONS /auth/me 204 No Content7 replies
WWasp-lang
•Created by Jake on 3/14/2024 in #đŸ™‹questions
Upload files using multer
your documentation is đŸ¥‡
8 replies
WWasp-lang
•Created by Jake on 3/14/2024 in #đŸ™‹questions
Upload files using multer
done.
import multer from "multer";
import path from "path";
const storage = multer.diskStorage({
destination: function (req, file, cb) {
cb(null, "/tmp/tp-uploads");
},
filename: function (req, file, cb) {
const originalName = path.parse(file.originalname).name;
const extension = path.parse(file.originalname).ext;
const timestamp = Date.now();
const newFilename =
${originalName}_${timestamp}${extension};
cb(null, newFilename);
},
});
const upload = multer({ storage: storage });
export const addMiddleware = (config) => {
config.set("multer", upload.single("file"));
return config;
};
export const uploadFile = (req, res, context) => {
console.log(req.body);
console.log(req.file);
const file = req.file;
return res.json({
fileExists: !!file,
});
};
8 replies
WWasp-lang
•Created by Jake on 3/14/2024 in #đŸ™‹questions
Upload files using multer
It's working now after changing the import per doc: https://wasp-lang.dev/docs/advanced/apis
import { api } from "wasp/client/api";
Is there any way I can supply a custom folder outside .wasp/* ?
.wasp/out/server/uploads
8 replies
WWasp-lang
•Created by Jake on 3/10/2024 in #đŸ™‹questions
useAuth() usage
Thanks miho. I am good if this is acceptable. My naive solution was to build 2 Navbars. One for public pages and the other for authenticated ones. Guess I will put it back to one and not worry about the 401.
4 replies
WWasp-lang
•Created by Jake on 3/9/2024 in #đŸ™‹questions
Passwordless authentication
my brain is fried i misread matija's message.. lol. will wait for passwordless. until then i will just go with email based authentication. thanks @miho
7 replies
WWasp-lang
•Created by Jake on 3/9/2024 in #đŸ™‹questions
Passwordless authentication
@miho do you have a github gist to integrate Lucia?
7 replies
WWasp-lang
•Created by Jake on 3/9/2024 in #đŸ™‹questions
Passwordless authentication
Sounds good. Thanks @matijash
7 replies
WWasp-lang
•Created by Jake on 3/8/2024 in #đŸ™‹questions
Integrating Radix UI
Thank you @miho You are awesome!
5 replies