Last active
August 29, 2015 14:04
-
-
Save maksadbek/103205ace1d5235f5ab4 to your computer and use it in GitHub Desktop.
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
var loopback = require('loopback'); | |
var Item = require('./models').Item; | |
var app = module.exports = loopback(); | |
app.model(Item); | |
app.use('/api', loopback.rest()); | |
app.listen(8080); | |
/* | |
GET /items | |
GET /items/count | |
GET /items/findOne | |
GET /items/{id} | |
GET /items/{id}/exists | |
POST /items | |
PUT /items | |
PUT /items/{id} | |
DELETE /items/{id} | |
*/ | |
//Чтобы легко изучить свой API, достаточно подключить встроенный модуль explorer: | |
var explorer = require('loopback-explorer'); | |
app.use('/explorer', explorer(app, {basePath: '/api'})); | |
var loopback = require('loopback'); | |
var explorer = require('loopback-explorer'); | |
var remoting = require('strong-remoting'); | |
var Item = require('./models').Item; | |
var app = module.exports = loopback(); | |
var rpc = remoting.create(); | |
function echo(ping, callback) { | |
callback(null, ping); | |
} | |
echo.shared = true; | |
echo.accepts = {arg: 'ping'}; | |
echo.returns = {arg: 'echo'}; | |
rpc.exports.system = { | |
echo: echo | |
}; | |
app.model(Item); | |
app.use('/api', loopback.rest()); | |
app.use('/explorer', explorer(app, {basePath: '/api'})); | |
app.use('/rpc', rpc.handler('rest')); | |
app.listen(8080); | |
/* | |
$ curl "http://localhost:8080/rpc/system/echo?ping=hello" | |
{ | |
"echo": "hello" | |
} | |
*/ | |
http://bannockburn.io/2013/06/realtime-grid-updates-with-extjs-nodejs-and-socket-io/ | |
http://www.ibm.com/developerworks/library/wa-nodejs-polling-app/ | |
http://briantford.com/blog/huuuuuge-angular-apps | |
http://www.google.com/url?q=http%3A%2F%2Fappium.io%2Fslate%2Fen%2Fmaster%2F%3Fruby%23toc_42&sa=D&sntz=1&usg=AFQjCNG4gK71pYhaRYcCKDNC0lOzokp-tQ | |
<!doctype html> | |
<html ng-app="store"> | |
<head> | |
<meta charset="utf-8"> | |
<title>AngularJS test</title> | |
<script src="angular.min.js"></script> | |
<!--<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">--> | |
<script> | |
(function(){ | |
var app = angular.module('store',[]); | |
app.controller('StoreController', function(){ | |
this.product = gem; | |
this.customer = customers; | |
}); | |
var gem = [{ | |
name: "Brilliant", | |
price: 2.95, | |
description: 'shiki shiki baba', | |
canPurchase: true, | |
soldOut:true | |
}, | |
{name: "Brilliant", | |
price: 2.95, | |
description: 'shiki shiki baba', | |
canPurchase: true, | |
soldOut:true | |
}]; | |
var customers = { | |
name: "Ahmad", | |
surname: "Avanesov", | |
address: "Kuylyuk, 6" | |
} | |
})(); | |
</script> | |
</head> | |
<body> | |
<div ng-controller="StoreController as store"> | |
<label>Name: </label> | |
<hr> | |
<h1 ng-hide="!store.product.soldOut">Available</h1> | |
<h1>Hello {{1+2}}!</h1> | |
<h2>{{store.product.name}}</h2> | |
<h2>${{store.product.price}}</h2> | |
<p>{{store.product.description}}</p> | |
<button ng-show="store.product.canPurchase">Add to Cart</button> | |
<hr> | |
<h2>{{store.customer.name}}</h2> | |
<h2>{{store.customer.surname}}</h2> | |
<h2>{{store.customer.address}}</h2> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment