Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
nuxt-api-party
Advanced tools
Nuxt 3 module to securely connect with any API.
useFetch
# pnpm
pnpm add -D nuxt-api-party
# npm
npm i -D nuxt-api-party
Add this module 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:
$jsonPlaceholder
– Returns the response data, similar to $fetch
useJsonPlaceholderData
– Returns multiple values similar to useFetch
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>
ℹ️ You can connect as many APIs as you want, just add them to the
endpoints
object.
corepack enable
pnpm install
pnpm run dev:prepare
pnpm run dev
MIT License © 2022-2023 Johann Schopplich
FAQs
Securely connect to any API with a server proxy and generated composables
The npm package nuxt-api-party receives a total of 1,197 weekly downloads. As such, nuxt-api-party popularity was classified as popular.
We found that nuxt-api-party demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.