
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
feathers-custom-methods
Advanced tools
Add custom methods to your services. For example:
emailService.send(address, subject, content)
npm i feathers-custom-methods
Server side, configure the plugin:
const customMethods = require('feathers-custom-methods')
app.configure(customMethods({
methods: {
email: ['send'] // allow calling app.service('email').send client side
}
}))
app.service('email').send = function (address, subject, content) {
// implement the method
// or implement it through a custom service:
// const emailService = {
// send(address, subject, content) { /* implementation */ }
// }
// app.use('/email', emailService)
}
Client side, add the client plugin:
import customMethods from 'feathers-cucstom-methods/client'
app.configure(customMethods({
methods: {
email: ['send']
}
}))
Now you can use send
as a method on the email
service client side:
app.service('email').send(address, subject, content)
.then(response => {
// handle response
}).catch(err => {
// handle error
})
The code above will call app.service('email').send
with the same arguments server side.
feathers-custom-methods uses the create method to send data from client to server. In other words, the call service.send(arg1, arg2)
is equivalent to:
service.create({
method: 'send',
arguments: [arg1, arg2]
})
This means that you can call custom methods through HTTP requests like this:
curl -X POST -d '{ "method": "send", "arguments": ["name@domain.com", "subject", "content"] }' http://localhost:3030/email --header "Content-Type:application/json"
npm test # will start node test.js
This will open a browser window. You must navigate back to terminal yourself. For more, see test.js.
MIT
FAQs
add custom methods to your feathersjs services
The npm package feathers-custom-methods receives a total of 0 weekly downloads. As such, feathers-custom-methods popularity was classified as not popular.
We found that feathers-custom-methods demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.