You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP β†’
Socket
Book a DemoInstallSign in
Socket

nuxt-api-party

Package Overview
Dependencies
Maintainers
1
Versions
107
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-api-party

Securely connect to any API with a server proxy and generated composables

2.2.8
latest
Source
npmnpm
Version published
Weekly downloads
1.8K
-4%
Maintainers
1
Weekly downloads
Β 
Created
Source

Nuxt API Party module

Nuxt API Party

Nuxt module to securely connect to any API.

Features

Setup

[!TIP] πŸ“– Read the documentation

npx nuxi@latest module add nuxt-api-party

Basic Usage

[!TIP] πŸ“– Read the documentation

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, refresh, error, status, clear } = 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

  • Clone this repository
  • Enable Corepack using corepack enable
  • Install dependencies using pnpm install
  • Run pnpm run dev:prepare
  • Start development server using pnpm run dev

Special Thanks

License

MIT License Β© 2022-PRESENT Johann Schopplich

MIT License Β© 2025-PRESENT Matthew Messinger

Keywords

api

FAQs

Package last updated on 05 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts