Added inbox as a Feathers service to do things the Feathers way.

parent 5e49a542
......@@ -39,7 +39,7 @@ app.use(express.json({type: ['application/json', 'application/activity+json', 'a
app.use(express.urlencoded({ extended: true }))
app.use(favicon(path.join(app.get('public'), 'favicon.ico')))
app.use('/.well-known/webfinger', function (req, res, next) {
app.get('/.well-known/webfinger', function (req, res, next) {
console.log('🤞 WebFinger request')
console.log(` ↳ Resource: ${req.query.resource}`)
......@@ -63,38 +63,25 @@ app.use('/.well-known/webfinger', function (req, res, next) {
res.send(response)
})
app.use('/inbox', function (req, res, next) {
console.log('📥 Inbox')
console.log(` ↳ Returning empty response.\n`)
res.send({})
})
app.use('/outbox', function (req, res, next) {
app.get('/outbox', function (req, res, next) {
console.log('📤 Outbox')
console.log(` ↳ Returning empty response.\n`)
res.send({})
})
app.use('/following', function (req, res, next) {
app.get('/following', function (req, res, next) {
console.log('👀 Following')
console.log(` ↳ Returning empty response.\n`)
res.send({})
})
app.use('/followers', function (req, res, next) {
app.get('/followers', function (req, res, next) {
console.log('👀 Followers')
console.log(` ↳ Returning empty response.\n`)
res.send({})
})
app.use('/', function (req, res, next) {
// Only capture the root URL, do not act
// as a catch-all.
if (req.originalUrl !== '/') {
return next()
}
app.all('/', function (req, res, next) {
res.format({
'text/html': function () {
......@@ -178,6 +165,17 @@ app.configure(services)
// Set up event channels (see channels.js)
app.configure(channels)
// Define inbox as a Feathers service.
app.use('inbox', {
async create (data, params) {
console.log('📥 Inbox')
console.log(` ↳ Returning empty response.\n`)
console.log(data)
return {}
}
})
// Configure a middleware for 404s and the error handler
app.use(function (req, res) {
console.log(`\n⚠️ Unhandled route`)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment