Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
@vtex/api
Advanced tools
This library enables developers to quickly integrate with the VTEX IO APIs and create full fledged node services using VTEX IO.
For a complete example on using @vtex/api
, check out this app: https://github.com/vtex-apps/service-example
The most basic usage is to export a new Service()
with your route handlers:
// Import global types
import './globals'
import { Service } from '@vtex/api'
import { clients } from './clients'
import example from './handlers/example'
// Export a service that defines route handlers and client options.
export default new Service({
clients,
routes: {
example,
},
})
This allows you to define middlewares that receive a Context
param which contains all IO Clients in the clients
property:
export const example = async (ctx: Context, next: () => Promise<void>) => {
const {state: {code}, clients: {apps}} = ctx
console.log('Received code:', code)
const apps = await apps.listApps()
ctx.status = 200
ctx.body = apps
ctx.set('Cache-Control', 'private')
await next()
}
ctx.clients.apps
is an instance of Apps
.
yarn
yarn watch
yarn
yarn link
yarn watch
cd ../<your-app>/node
yarn link @vtex/api
Now, when you get a workspace up and running for your app with vtex link
, you'll have this package linked as well.
When done developing, don't forget to unlink it from
<your-app>/node
:yarn unlink @vtex/api
FAQs
VTEX I/O API client
We found that @vtex/api 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.