app = angular.module('<%= moduleName %>')

app.config (
  $stateProvider,
  $urlRouterProvider,
  $locationProvider,
  $httpProvider,
  $compileProvider
) ->

  # this boosts performance a little bit,
  # just make sure the environment variable NODE_ENV is
  # set to "production" on the production server
  # to help debugging on the production site, open the console,
  # type `angular.reloadWithDebugInfo()` & hit enter
  if process.env.NODE_ENV is 'production'
    $compileProvider.debugInfoEnabled(false)

  # IE caches XHR requests. In order to avoid this, we set an HTTP response
  # header to mimic default behaviors of modern browsers.
  $httpProvider.defaults.headers.common['Cache-Control'] = 'no-cache'

  # By adding this
  # we avoid getting href to be formed as unsafe in older browsers
  $compileProvider.aHrefSanitizationWhitelist(
    ///
    ^\s*(
    https?|
    ftp|
    mailto|
    \#|
    \#\!
    ):///
  )

  # this makes clean URLs in modern browsers
  # e.g. "site.com/resource" rather than "site.com/#/resource"
  # (requires server-side URL rewrites - a wildcard route that responds with
  # index.html is usually enough)
  # otherwise just set this to false
  $locationProvider.html5Mode(true)

  # hashes are cool, but hashbangs are cooler for SEO
  # https://developers.google.com/webmasters/ajax-crawling/
  $locationProvider.hashPrefix('!')

  # redirect to root route when non-existent paths are accessed
  # maybe change this to respond with a hipster SVG 404 page,
  # you know, if you think you're cool enough to handle it
  $urlRouterProvider.otherwise '/'

  $stateProvider

    .state 'home',
      url: '/'

    .state 'docs',
      url: '/docs'
      controller: 'MessageController'
      templateUrl: 'templates/message.html'
