npm install
node index
In another terminal:
curl 127.0.0.1:3030/myservice
const feathers = require('@feathersjs/feathers'); | |
const express = require('@feathersjs/express'); | |
process.on('unhandledRejection', (reason, p) => { | |
console.error('Unhandled Rejection'); | |
console.error(reason); | |
}); | |
const app = express(feathers()); | |
app.configure(express.rest()); | |
app.hooks({ | |
error: () => { | |
console.log('Throwing error in error hook'); | |
throw new Error('Simulated error'); | |
} | |
}) | |
app.use('/myservice', { | |
async find(data, params) { | |
// trigger error hook | |
throw new Error(); | |
}, | |
}); | |
app.listen(3030); | |
console.log('Feathers app started on 127.0.0.1:3030'); |
{ | |
"name": "feathers-express-error", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"@feathersjs/express": "^1.2.0", | |
"@feathersjs/feathers": "^3.1.1" | |
} | |
} |