Refactor api.url to api.v1 (for later API changes, maybe)
This commit is contained in:
parent
88db838830
commit
1457cfcf56
|
@ -1,7 +1,7 @@
|
|||
const crypto = require('crypto')
|
||||
|
||||
module.exports = {
|
||||
url: (path) => { return '/api/v1' + path },
|
||||
v1url: (path) => { return '/api/v1' + path },
|
||||
isURLValid: (url) => {
|
||||
try {
|
||||
const u = new URL(url)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = {
|
||||
url: require('./api-utils.js').url,
|
||||
v1: require('./api-utils.js').v1url,
|
||||
auth: require('./api/auth.js'),
|
||||
feed: require('./api/feed.js'),
|
||||
accounts: require('./api/accounts.js'),
|
||||
|
|
|
@ -64,12 +64,12 @@ app.on('apex-outbox', activity.federation.outbox)
|
|||
app.on('apex-inbox', activity.federation.inbox)
|
||||
|
||||
// API defines
|
||||
/* POST */ app.route(api.url('/auth/register')).post(api.auth.register.post)
|
||||
/* POST */ app.route(api.url('/auth/login')).post(api.auth.login.post)
|
||||
/* GET */ app.route(api.url('/feed/meet')).get(api.feed.meet.get)
|
||||
/* GET */ app.route(api.url('/me/pending_follows')).get(api.me.pending_follows.get)
|
||||
/* POST */ app.route(api.url('/accounts/follow')).post(api.accounts.follow.post)
|
||||
/* POST */ app.route(api.url('/accounts/unfollow')).post(api.accounts.unfollow.post)
|
||||
/* POST */ app.route(api.v1('/auth/register')).post(api.auth.register.post)
|
||||
/* POST */ app.route(api.v1('/auth/login')).post(api.auth.login.post)
|
||||
/* GET */ app.route(api.v1('/feed/meet')).get(api.feed.meet.get)
|
||||
/* GET */ app.route(api.v1('/me/pending_follows')).get(api.me.pending_follows.get)
|
||||
/* POST */ app.route(api.v1('/accounts/follow')).post(api.accounts.follow.post)
|
||||
/* POST */ app.route(api.v1('/accounts/unfollow')).post(api.accounts.unfollow.post)
|
||||
|
||||
// initialize
|
||||
client.connect({ useNewUrlParser: true })
|
||||
|
|
Loading…
Reference in New Issue