Install feathers-cli using the following command: npm install -g @feathersjs/cli.
To create a service, navigate to your project directory and run this command feathers generate service. It will ask some questions like service name.
If you don't already have an app then run this command to create one: feathers generate app.
Thats it!
Update:
Lets assume you have a service named organizations and you want to create a custom endpoint like custom-organization. Now, create a file inside services > organizations named custom-organizations.class.js. Add the following line in your organizations.service.js file.
// Import custom class
const { CustomOrganizations } = require('./custom-organizations.class');
// Initialize custom endpoint
app.use('/custom-organizations', new CustomOrganizations(options, app));
Add the following code in your custom-organizations.class.js file.
const { Service } = require('feathers-mongoose');
exports.CustomOrganizations = class CustomOrganizations extends Service {
constructor(options, app) {
super(options);
}
async find() {
return 'Test data';
}
};
Now, if you send a get request to /custom-organizations endpoint then you should get Test data.
Hope it helps.
Wrote an article about it here.