Gothsec / StockIn

Inventory management system for Pymes
http://localhost:5173
Other
3 stars 0 forks source link

Migrate local database (mysql) to supabase (postgres) #34

Open garaven opened 14 hours ago

garaven commented 14 hours ago

Example

image

  import { createClient } from "@supabase/supabase-js";

  const supabase = createClient("https://<project>.supabase.co", "<your-anon-key>");

  function App() {
    const [countries, setCountries] = useState([]);

    useEffect(() => {
      getCountries();
    }, []);

    async function getCountries() {
      const { data } = await supabase.from("countries").select();
      setCountries(data);
    }

    return (
      <ul>
        {countries.map((country) => (
          <li key={country.name}>{country.name}</li>
        ))}
      </ul>
    );
  }

  export default App;
1Orchestratooor1 commented 10 hours ago

But, do you need to configure Supabase on my own first or something like that?