2.0.0 • Published 19 days ago

nuxt-api-party v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
19 days ago

nuxt-api-party

Nuxt API Party

npm version

Nuxt module to securely connect to any API.

Features

Setup

!TIP(https://nuxt-api-party.byjohann.dev)

npx nuxi@latest module add api-party

Basic Usage

!TIP(https://nuxt-api-party.byjohann.dev)

Add the Nuxt API Party to your Nuxt config and prepare your first API connection by setting an endpoint object with the following properties for the apiParty module option:

// `nuxt.config.ts`
export default defineNuxtConfig({
  modules: ['nuxt-api-party'],

  apiParty: {
    endpoints: {
      jsonPlaceholder: {
        url: process.env.JSON_PLACEHOLDER_API_BASE_URL!,
        // Global headers sent with each request
        headers: {
          Authorization: `Bearer ${process.env.JSON_PLACEHOLDER_API_TOKEN}`
        }
      }
    }
  }
})

If you were to call your API jsonPlaceholder, the generated composables are:

Use these composables in your templates or components:

<script setup lang="ts">
const { data, pending, refresh, error } = await useJsonPlaceholderData('posts/1')
</script>

<template>
  <h1>{{ data?.title }}</h1>
  <pre>{{ JSON.stringify(data, undefined, 2) }}</pre>
</template>

!TIP You can connect as many APIs as you want, just add them to the endpoints object.

💻 Development

  1. Clone this repository
  2. Enable Corepack using corepack enable
  3. Install dependencies using pnpm install
  4. Run pnpm run dev:prepare
  5. Start development server using pnpm run dev

Special Thanks

License

MIT License © 2022-PRESENT Johann Schopplich

2.0.0

19 days ago

1.1.2

1 month ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.1

3 months ago

1.0.0

4 months ago

0.23.0

4 months ago

0.22.3

4 months ago

0.22.2

5 months ago

0.22.1

5 months ago

0.21.3

5 months ago

0.21.2

6 months ago

0.21.0

7 months ago

0.20.1

8 months ago

0.20.0

8 months ago

0.19.0

8 months ago

0.17.1

8 months ago

0.18.1

8 months ago

0.18.0

8 months ago

0.15.4

9 months ago

0.11.0

12 months ago

0.11.1

12 months ago

0.13.0

10 months ago

0.11.2

12 months ago

0.13.1

9 months ago

0.11.3

12 months ago

0.15.0

9 months ago

0.11.4

11 months ago

0.15.1

9 months ago

0.17.0

8 months ago

0.15.2

9 months ago

0.16.3

9 months ago

0.16.4

8 months ago

0.12.0

11 months ago

0.14.1

9 months ago

0.16.0

9 months ago

0.14.2

9 months ago

0.16.1

9 months ago

0.14.3

9 months ago

0.16.2

9 months ago

0.10.2

1 year ago

0.10.3

1 year ago

0.10.4

1 year ago

0.10.5

12 months ago

0.9.4

1 year ago

0.9.3

1 year ago

0.10.1

1 year ago

0.10.0

1 year ago

0.9.0

1 year ago

0.8.1

1 year ago

0.7.2

1 year ago

0.8.0

1 year ago

0.7.1

1 year ago

0.9.2

1 year ago

0.9.1

1 year ago

0.8.2

1 year ago

0.7.0

1 year ago

0.6.5

1 year ago

0.6.4

1 year ago

0.6.3

1 year ago

0.6.2

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.5.6

1 year ago

0.5.5

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.5.0

1 year ago

0.4.4

1 year ago

0.4.2

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago