Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@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
The npm package @vtex/api receives a total of 5,505 weekly downloads. As such, @vtex/api popularity was classified as popular.
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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
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.