Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/pkg/angular/demo/todo/webserver.js

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 var connect = require('connect');
2 var dart2jsaas = require('dart2jsaas');
3 var playback = require('../../playback_middleware/lib/middleware.js');
4
5 var dart2jsaasEnpoints = dart2jsaas.endpoints({
6 fetcherBaseUrl: 'http://localhost:3000/'
7 });
8
9 function endsWith(haystack, needle) {
10 if (haystack.length < needle.length) return false;
11
12 var index = haystack.indexOf(needle);
13 return index == (haystack.length - needle.length);
14 }
15
16 var app = connect()
17 .use(dart2jsaasEnpoints.dart2js)
18 .use(dart2jsaasEnpoints.snapshot)
19 .use(playback.endpoint())
20 // Serve the /todos for the app.
21 .use(function(req, res, next) {
22 if (req.url.indexOf('/todos') != 0) {
23 next();
24 return;
25 }
26 var data = JSON.stringify([
27 {text: 'Done from server', done: true},
28 {text: 'Not done from server', done: false}
29 ]);
30
31 res.writeHead(200, {
32 'Content-Type': 'text/plain',
33 'Content-Length': data.length
34 });
35 res.end(data);
36 })
37 // Redirect the playback_data.dart file to the playback service.
38 .use(function(req, res, next) {
39 if (endsWith(req.url, '/playback_data.dart')) {
40 res.writeHead(302, {
41 'Location': '/record'
42 });
43 res.end();
44 return;
45 }
46 next();
47 })
48 .use(connect.static(process.cwd()));
49
50 connect.createServer(app).listen(3000);
51
52 console.log('Listening on port 3000');
OLDNEW
« no previous file with comments | « third_party/pkg/angular/demo/todo/web/todo.dart ('k') | third_party/pkg/angular/example/README.todo.md » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698