GithubHelp home page GithubHelp logo

carpad88 / nuxt-medusa Goto Github PK

View Code? Open in Web Editor NEW

This project forked from baroshem/nuxt-medusa

0.0 0.0 0.0 805 KB

🛍️ Medusa module for Nuxt

Home Page: https://nuxt-medusa.vercel.app

License: MIT License

TypeScript 65.35% Vue 34.65%

nuxt-medusa's Introduction

nuxt-medusa

nuxt-medusa

npm version npm downloads License

Medusa module for Nuxt.

Features

  • Nuxt 3 ready
  • Wrapper around @medusajs/medusa-js
  • Handy composables like useMedusaClient
  • Usage in API server routes with serverMedusaClient
  • TypeScript support

Quick Setup

  1. Add nuxt-medusa dependency to your project
npm install --save-dev nuxt-medusa # pnpm or yarn
  1. Add nuxt-medusa to the modules section of nuxt.config.ts:
export default defineNuxtConfig({
  modules: ['nuxt-medusa'],
})
  1. Create .env file with following MEDUSA_URL variable:
MEDUSA_URL=<YOUR_MEDUSA_URL> # By default http://localhost:9000

And that's it! You can now fetch data from Medusa in Nuxt ✨

<script setup lang="ts">
  const client = useMedusaClient();
  const { products } = await client.products.list();
</script>

If you are encountering problems with CORS from Medusa, make sure that process.env.STORE_CORS in medusa-config.js file is pointing to your local Nuxt project. By default, Medusa has CORS set for http://localhost:8000 while Nuxt is running by default on http://localhost:3000

Development

# Install dependencies
yarn

# Generate type stubs
yarn dev:prepare

# Develop with the playground
yarn dev

# Build the playground
yarn dev:build

# Run ESLint
yarn lint

# Run Vitest
yarn test
yarn test:watch

# Release new version
yarn release

nuxt-medusa's People

Contributors

baroshem avatar intevel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.