WaspW
Wasp15mo ago
BeReal

syntax of importing from wasp

Hi I am pretty newbie to typescript and wasp, I have python experience though. I was asking chatgpt to create a simple function to try and call my python backend. I am in the process of combining them.

import { action } from '@wasp/actions'

export const analyzeData = action({
  run: async ({ data }) => {
    const response = await fetch('http://localhost:8000/analyze', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(data),
    })
    return await response.json()
  }
})


chatGPT suggested this, but I cant import like this its giving errors on running wasp start . Is chatGPT completely wrong or am I doing sth wrong, where can I find some documentation on how to do this correctly
Was this page helpful?