Skip to content

Instantly share code, notes, and snippets.

@srph
Created August 7, 2014 17:08
Show Gist options
  • Save srph/8af96e0b70d443ab8693 to your computer and use it in GitHub Desktop.
Save srph/8af96e0b70d443ab8693 to your computer and use it in GitHub Desktop.
apiv1.coffeescript
app = require '../app'
app.constant 'APIv1', ->
api = {}
# Base (alias)
base = '/api/v1'
# Base
api.base = base
# Auth
api.auth {}
api.auth.base = '#{base}/auth'
api.auth.check = '#{this.auth.base}/check'
api.auth.login = '#{this.auth.base}/login'
api.auth.logout = '#{this.auth.base}/logout'
# User
api.user = {}
api.user.base = '#{base}/users'
api.user.register = '#{this.user.base}/register'
api.user.connect = '#{this.user.base}/connection'
api.user.accept = '#{this.user.connect}/accept'
api.user.connection = (id) ->
return '#{this.user.base}/#{id}/connection'
api.user.connected = (id) ->
return '#{this.user.base}/#{id}/connected'
# Post
api.post = {}
api.post.base = '#{base}/post'
# Guilds
api.guild = {}
api.guild.base = '#{base}/post'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment