angular-redux / example-app

Example using @angular-redux/store, @angular-redux/router, and @angular-redux/form together with the Angular CLI
123 stars 101 forks source link

503 on mock data, switched to data urls #40

Closed scottschafer closed 7 years ago

scottschafer commented 7 years ago

I was getting 503 errors with the mock data URLs, so I changed to data urls in service.ts:

const ELEPHANT_URL = 'data:text/plain;charset=utf-8,%5B%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Ellie"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%202%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Edwin"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%201%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Entwhistle"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%203%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Edith"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%202%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Esther"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%203%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Elephant"%2C%0D%0A%20%20%20%20"name"%3A%20"Edward"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%201%0D%0A%20%20%7D%0D%0A%5D';

const LION_URL = 'data:text/plain;charset=utf-8,%5B%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Lion"%2C%0D%0A%20%20%20%20"name"%3A%20"Larry"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%202%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Lion"%2C%0D%0A%20%20%20%20"name"%3A%20"Louise"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%203%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Lion"%2C%0D%0A%20%20%20%20"name"%3A%20"Laura"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%201%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Lion"%2C%0D%0A%20%20%20%20"name"%3A%20"Louis"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%203%0D%0A%20%20%7D%2C%0D%0A%20%20%7B%20%20%20%20%0D%0A%20%20%20%20"type"%3A%20"Lion"%2C%0D%0A%20%20%20%20"name"%3A%20"Lauren"%2C%0D%0A%20%20%20%20"ticketPrice"%3A%202%0D%0A%20%20%7D%0D%0A%5D';

// A fake API on the internets. const URLS = {

};

SethDavenport commented 7 years ago

Huh. That's weird. 503 normally means the upstream site (in this case mocky.io) is down (behind some proxy). I guess it is a bit annoying to depend on an external service for that reason.

The data URL idea is interesting. However I did want the app to make an actual HTTP request.