Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Add a custom Express route
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir-61 committed Nov 11, 2016
1 parent ab4bb17 commit de77397
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
<body>
<h1>LoopBack Rocks!</h1>
<p>Hello World... </p>
</body>
</body>
8 changes: 4 additions & 4 deletions common/models/coffee-shop.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ module.exports = function(CoffeeShop) {
'status', {
http: {
path: '/status',
verb: 'get'
verb: 'get',
},
returns: {
arg: 'status',
type: 'string'
}
type: 'string',
},
}
);
};
};
10 changes: 5 additions & 5 deletions server/boot/create-sample-models.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ module.exports = function(app) {

app.models.CoffeeShop.create([{
name: 'Bel Cafe',
city: 'Vancouver'
city: 'Vancouver',
}, {
name: 'Three Bees Coffee House',
city: 'San Mateo'
city: 'San Mateo',
}, {
name: 'Caffe Artigiano',
city: 'Vancouver'
}, ], function(err, coffeeShops) {
city: 'Vancouver',
}], function(err, coffeeShops) {
if (err) throw err;

console.log('Models created: \n', coffeeShops);
});
});
};
};
9 changes: 9 additions & 0 deletions server/boot/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use strict';

module.exports = function(app) {
// Install a "/ping" route that returns "pong"
app.get('/ping', function(req, res) {
res.send('pong');
});
};

2 changes: 1 addition & 1 deletion server/middleware.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"files": {
"loopback#static": {
"params": "$!../client"
}
}
},
"final": {
"loopback#urlNotFound": {}
Expand Down

0 comments on commit de77397

Please sign in to comment.