This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
15 changed files
with
747 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import EmberRouter from '@ember/routing/router'; | ||
import config from './config/environment'; | ||
|
||
const Router = EmberRouter.extend({ | ||
location: config.locationType, | ||
rootURL: config.rootURL | ||
}); | ||
|
||
Router.map(function() {}); | ||
|
||
export default Router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import Route from '@ember/routing/route'; | ||
import { inject as service } from '@ember/service'; | ||
import { get } from '@ember/object'; | ||
|
||
export default Route.extend({ | ||
ajax: service(), | ||
|
||
model() { | ||
return get(this, 'ajax').request('http://localhost:3000/posts', { | ||
dataType: 'json', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
} | ||
}); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{outlet}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<ul> | ||
{{#each model as |post|}} | ||
<li> | ||
{{post.title}} | ||
</li> | ||
{{/each}} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
var POSTS = [ | ||
{ | ||
title: 'First Post' | ||
}, | ||
{ | ||
title: 'Second Post' | ||
} | ||
]; | ||
|
||
module.exports = { | ||
POSTS | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
var express = require('express'); | ||
var posts = require('./fixtures').POSTS; | ||
|
||
var app = express(); | ||
app.use((req, res, next) => { | ||
res.header('Access-Control-Allow-Origin', '*'); | ||
res.header('Access-Control-Allow-Methods', 'GET, OPTIONS'); | ||
res.header( | ||
'Access-Control-Allow-Headers', | ||
'Content-Type, Authorization, Content-Length, X-Requested-With' | ||
); | ||
|
||
if ('OPTIONS' === req.method) { | ||
res.sendStatus(200); | ||
} else { | ||
next(); | ||
} | ||
}); | ||
|
||
app.get('/posts', (req, res) => { | ||
res.json(posts); | ||
}); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
'use strict'; | ||
|
||
var expect = require('chai').expect; | ||
var setupTest = require('ember-fastboot-addon-tests').setupTest; | ||
|
||
var expressApp = require('./helpers/server'); | ||
var POSTS = require('./helpers/fixtures').POSTS; | ||
|
||
describe('ember-ajax', function() { | ||
setupTest('fastboot' /*, options */); | ||
|
||
beforeEach(function() { | ||
this.server = expressApp.listen(3000); | ||
}); | ||
|
||
afterEach(function() { | ||
this.server.close(); | ||
}); | ||
|
||
it('works in a FastBoot environment', function() { | ||
return this.visit('/').then(function(res) { | ||
var $ = res.jQuery; | ||
var response = res.response; | ||
|
||
expect(response.statusCode).to.equal(200); | ||
expect($('li').length).to.equal(POSTS.length); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Route from '@ember/routing/route'; | ||
import { inject as service } from '@ember/service'; | ||
import { get } from '@ember/object'; | ||
|
||
export default Route.extend({ | ||
ajax: service(), | ||
|
||
model() { | ||
return get(this, 'ajax').request( | ||
'https://api.github.com/repos/ember-cli/ember-ajax/commits', | ||
{ | ||
headers: { | ||
'User-Agent': 'Ember AJAX Testing' | ||
} | ||
} | ||
); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<ul> | ||
{{#each model as |record|}} | ||
<li> | ||
<a href={{record.commit.url}}> | ||
{{record.commit.message}} | ||
</a> | ||
</li> | ||
{{/each}} | ||
</ul> |
Oops, something went wrong.