Code Monkey home page Code Monkey logo

breeze.js.samples's Introduction

About the Breeze JS Samples

The Breeze JavaScript client samples demonstrate BreezeJS in action in different technology environments. They are (almost) all maintained by the Breeze core team.

These are end-to-end samples which means that most of them have both client and server code. The server code could be written in .NET, Node, Ruby, etc.

What they all have in common is an HTML/JavaScript front-end, written with Breeze.js

Learn more about these samples on the Breeze website.

Download

The sample code is maintained in the breeze.js.samples repository on github where it is maintained continuously between releases of BreezeJS itself.

For the current build, download a zip of the master branch.

For earlier releases, visit the github releases page and select the version of interest.

Once you have the zip on your machine

  • Unblock it (a Windows security button on the zip properties sheet).

  • Extract it

Finding the sample in the repo

Now locate the sample of interest.

The breeze.js.samples library is divided by server stack into different sub-directories:

  • net - Microsoft.NET server samples with Visual Studio solution and project files

  • node - Node server samples for Breeze client apps.

  • java - Java server samples for Breeze client apps.

  • no-server - No server at all. The sample reaches out to a public web service. In most cases these are pure JavaScript clients.

  • ruby - Ruby-on-Rails server samples for pure JavaScript client apps

Build and run

Many of the .NET samples have Visual Studio solution files and you can often just launch-build-and-run in Visual Studio.

Some require a little preparation first, e.g., downloading supporting libraries and installing sample databases.

Look for a sample-specific "readme" that describes how to install and run.

Your OS may interrupt the build flow with security questions, especially if you neglected to "unblock" the zip. Just play along, saying "yes ... go ahead and do that", every time it presents a scary message and asks if you really want to proceed.

breeze.js.samples's People

Contributors

bryant1410 avatar cbruen1 avatar coni2k avatar jtraband avatar marcelgood avatar steveschmitt avatar thomasburleson avatar wardbell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

breeze.js.samples's Issues

Possible typo in zza-node-mongo

First off, thank you for putting together such helpful demo projects (and, of course, for creating a killer library).

I wanted to point out a possible typo in Line 59 of zza-node-mongo/server/breeze-routes.js. The line appears as:

res.setHeader("Content-Type:", "application/json");

which throws an error, apparently due to the : after Content-Type. Changing it to:

res.setHeader("Content-Type", "application/json");

allows the project to run properly.

Please let me know if the colon was intentional.

Cheers!

Breeze DocCode fails some tests

Trying to run the breeze DocCode test suite using the latest VS 2017 community (V 15.6.6) and chrome browser version 66.0.3359.139 (Official Build) (64-bit)

Four of the tests fail ..... output as follows:

Breeze DocCode Test Suite
Hide passed testsCheck for GlobalsNo try-catchModule:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36
Tests completed in 55690 milliseconds.
1366 assertions of 1370 passed, 4 failed.

namingConvention tests (UnderscoreCamelCaseConvention): global failure (1, 0, 1)Rerun1 ms
Uncaught TypeError: breeze.AjaxRestInterceptor is not a constructor
Source:
http://localhost:56337/tests/multiControllerTests.js:41
navigationTests: Deleting child in 1-to-1 relationship does not modify the parent (1, 3, 4)Rerun2 ms
parent unchanged after child deleted
Expected:
"Unchanged"
Result:
"Modified"
Diff:
"Unchanged" "Modified"
Source:
at Object. (http://localhost:56337/tests/navigationTests.js:455:9)
at Test.run (http://localhost:56337/Scripts/qunit.js:203:31)
at http://localhost:56337/Scripts/qunit.js:361:26
at process (http://localhost:56337/Scripts/qunit.js:1453:37)
at http://localhost:56337/Scripts/qunit.js:479:21
query xtras: expand query preserves FK change (2, 6, 8)Rerun234 ms
re-queried order's changed EmployeeID FK was preserved
Expected:
2
Result:
1
Diff:
2 1
Source:
at gotRequeriedOrder (http://localhost:56337/tests/queryXtraTests.js:133:15)
at _fulfilled (http://localhost:56337/Scripts/q.js:798:54)
at http://localhost:56337/Scripts/q.js:827:30
at Promise.promise.promiseDispatch (http://localhost:56337/Scripts/q.js:760:13)
at http://localhost:56337/Scripts/q.js:574:44
at MessagePort.flush (http://localhost:56337/Scripts/q.js:108:17)
re-queried order's Employee should be null because EmployeeID FK is changed
Source:
at gotRequeriedOrder (http://localhost:56337/tests/queryXtraTests.js:138:15)
at _fulfilled (http://localhost:56337/Scripts/q.js:798:54)
at http://localhost:56337/Scripts/q.js:827:30
at Promise.promise.promiseDispatch (http://localhost:56337/Scripts/q.js:760:13)
at http://localhost:56337/Scripts/q.js:574:44
at MessagePort.flush (http://localhost:56337/Scripts/q.js:108:17)

Server cannot route '/'

I've been struggling to get any Zza Breeze/Node/Mongodb sample to work on my machine. Don't know if there's something unspecified in the required build or package dependency declarations.

I've fixed the issue associated with the official sample from http://www.breezejs.com/samples/zza , which arises from it promiscuously upgrading to Express 4.0 (which isn't compatible with the API calls it makes). However, even after that fix I just get the text "Cannot get /" as the front page of the sample app.

Sadly I get exactly the same behaviour from the version you're maintaining, and also the version available at... https://github.com/IdeaBlade/Breeze/tree/master/Samples_Unpublished/Zza/Zza.ExpressServer
...so there must be something up with my environment I guess but I can't trace the way the front page is served. Visiting http://localhost:3000/breeze/zza/Products does give me a json dump of the product database, so something must be fairly functional, but there's no front page.

I'm a bit puzzled how any of these different implementations are meant to get app resources to satisfy route ('/'). Is there maybe a missing module in my build which isn't being pulled in by npm install (package.json) ?

Versions I'm running...
$ mongod --version
db version v2.6.0
$node --version
v0.10.26
$ npm -v
1.4.4

Be glad of any suggestions to explain why the '/' route is dying.

New items in Todo-zuma app not stashed

A follow up to #26 / 7815afb

In my case stashing on adding new items no longer works, as mentioned in my pull request (which should contain both lines changed):

To reproduce:
* Take current sample code (7815afb)
* Windows 8.1 / Google 39
* Start with launch-windows.lnk
* Set breakpoint in wip-service.js line 60
* Add new todo item --> Breakpoint is not reached / F5 and new item don't show up

Only EntityStateChange and Attach events are called.

rxjs compile errors due to typescript < 2.0

D:\Dev\Github\breeze.js.samples\no-server\angular2-breeze [master ≡ +0 ~1 -0 !]> npm start

> [email protected] start D:\Dev\Github\breeze.js.samples\no-server\angular2-breeze
> tsc && concurrently "tsc -w" "lite-server"

node_modules/breeze-bridge-angular2/node_modules/rxjs/Observable.d.ts(29,34): error TS1005: ')' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Observable.d.ts(29,46): error TS1005: '=' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Observable.d.ts(29,49): error TS1109: Expression expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Observable.d.ts(29,78): error TS1144: '{' or ';' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Observable.d.ts(29,94): error TS1005: ';' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,28): error TS1005: ')' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,36): error TS1005: '=' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,39): error TS1109: Expression expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,52): error TS1005: ';' expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,55): error TS1131: Property or signature expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,59): error TS1109: Expression expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,67): error TS1109: Expression expected.
node_modules/breeze-bridge-angular2/node_modules/rxjs/Scheduler.d.ts(5,83): error TS1109: Expression expected.

Had to edit package.json and update

"typescript": "^1.8.10",

to

"typescript": "^2.0.0",

sample todo-angular responds with 500

Find bellow the server activity and the callstack.

GET / 304 7ms
GET /css/reset.css 304 4ms
GET /css/toastr.css 304 1ms
GET /css/todo.css 304 2ms
GET /bower_components/angular/angular.js 304 2ms
GET /bower_components/breeze-client/breeze.debug.js 304 2ms
GET /bower_components/jquery/dist/jquery.min.js 304 1ms
GET /bower_components/breeze-client/build/adapters/breeze.bridge.angular.js 304 1ms
GET /bower_components/toastr/toastr.js 304 0ms
GET /bower_components/breeze-client-labs/breeze.savequeuing.js 304 1ms
GET /app/main.js 304 1ms
GET /app/logger.js 304 2ms
GET /app/dataservice.js 304 1ms
GET /app/controller.js 304 2ms
GET /app/view.html 304 0ms
GET /breeze/todos/Metadata 304 4ms
Executing (default): SELECT `Id`, `Description`, `CreatedAt`, `IsDone`, `IsArchived` FROM `TodoItem` AS `TodoItem` WHERE `TodoItem`.`IsArchived`=false ORDER BY `CreatedAt`;
GET /breeze/todos/Todos?%7B%22where%22%3A%7B%22IsArchived%22%3Afalse%7D%2C%22orderBy%22%3A%5B%22CreatedAt%22%5D%7D& 500 17ms - 72b
--------------
Status: 500
{
  "message": "Header name must be a valid HTTP Token [\"Content-Type:\"]"
}
TypeError: Header name must be a valid HTTP Token ["Content-Type:"]
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:337:11)
    at returnResults (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/routes.js:141:13)
    at null.<anonymous> (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/routes.js:136:13)
    at tryCatch1 (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/util.js:43:21)
    at Promise$_callHandler [as _callHandler] (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:649:13)
    at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:663:18)
    at Promise$_settlePromiseAt (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:826:14)
    at Promise._settlePromiseAt (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/lib/promise.js:66:18)
    at Promise$_settlePromises [as _settlePromises] (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:969:14)
    at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/async.js:75:12)
    at Async$consumeFunctionBuffer (/Users/devmac/workspace/misc/breeze.js.samples/node/todo-angular/server/node_modules/sequelize/node_modules/bluebird/js/main/async.js:38:14)
    at nextTickCallbackWith0Args (node.js:452:9)
    at process._tickCallback (node.js:381:13)

Zza(Code snippet) Breeze Error: A MergeStrategy of 'Disallowed' does not allow you to attach an entity when an entity with the same key is already attached

I am getting this error when running the sample application for AngularJS from Breeze's website.

This is the code for the controller breezectl.js

'use strict';

angular.module('mean').controller('breezeController', ['$scope', 'Global', 'dataservice',
    function($scope, Global, dataservice) {
        $scope.global = Global;
        $scope.breeze = {
            name: 'Breeze Sample'
        };

        //$scope.results = dataservice;

        function getProducts() {
            function success(data) {
                $scope.results = data;
            }
            function failed(error) {
                $scope.results = error.message;
            }

            dataservice.getAllProducts()
                .then(success)
                .catch(failed); 
        }

        getProducts();
    }
]);

dataservice.getAllProducts() enters the catch(failed) branch with this error message: A MergeStrategy of 'Disallowed' does not allow you to attach an entity when an entity with the same key is already attached

This is the code for dataservice.js

'use strict';

angular.module('mean').factory('dataservice', ['breeze', 'entityManagerFactory', 
    function(breeze, entityManagerFactory) {
        var manager = entityManagerFactory.newManager();

        function getAllProducts(){
            function success(data) {
                return data.results;
            }

            return breeze.EntityQuery.from('Products')
                .using(manager).execute()
                .then(success);
        }


        var service = {
            getAllProducts: getAllProducts
        };
        return service;
    }
]);

Note: A direct call to Products from the Restful API (http://localhost:3000/breeze/northwind/Products) works properly and returns a set of Json objects representing all of the products in the collection.

I just want to list my data of mongodb from angularjs front-end.

Did you finished all stuffs on the backlog?

Hi,
Currently the source code for BMEAN doesn't have ability to save changes and I see:
"On the backlog
This sample is a work in progress. Among the features yet to be implemented:
Place the order (and save it to the database)
Client- and server-side validation
Deliver a delicious, hot pizza to your laptop"
So did you implement the save changes function yet? if no, can you instruct me to do that?
Thanks

Relative URLs within odata $batch requests receive 404; SaveChanges fails

To reproduce:

  1. Start with Breeze/breeze.js.samples/net/ODataBreezejsSample
  2. nuget update Microsoft.AspNet.WebApi.OData to 5.3.1
  3. Run the app; navigate to /Home/Bowa; try deleting a Todo list, or adding a new item to a ToDo list. SaveChanges will fail.

The request:

--batch_3282-396a-353f
Content-Type: multipart/mixed; boundary=changeset_b5e1-6019-8b2f

--changeset_b5e1-6019-8b2f
Content-Type: application/http
Content-Transfer-Encoding: binary

POST odata/TodoItems HTTP/1.1
Content-ID: 1
DataServiceVersion: 2.0
Accept: application/atomsvc+xml;q=0.8, application/json;odata=fullmetadata;q=0.7, application/json;q=0.5, */*;q=0.1
Content-Type: application/json
MaxDataServiceVersion: 3.0

{"Id":-2,"TodoListId":4,"Description":"falalalala","IsDone":false}
--changeset_b5e1-6019-8b2f--

--batch_3282-396a-353f--

The response:

HTTP/1.1 202 Accepted
Cache-Control: no-cache
Pragma: no-cache
Content-Type: multipart/mixed; boundary=batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96
Expires: -1
Server: Microsoft-IIS/8.0
DataServiceVersion: 3.0
X-AspNet-Version: 4.0.30319
X-SourceFiles: =?UTF-8?B?Qzpcc3JjXGdpdGh1YlxCcmVlemVcT0RhdGFTYW1wbGUrRW50aXR5UmVwb3NpdG9yeVxPRGF0YUJyZWV6ZWpzU2FtcGxlXG9kYXRhXCRiYXRjaA==?=
X-Powered-By: ASP.NET
Date: Thu, 25 Dec 2014 21:33:14 GMT
Content-Length: 681

--batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96
Content-Type: multipart/mixed; boundary=changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec

--changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec
Content-Type: application/http
Content-Transfer-Encoding: binary

HTTP/1.1 404 Not Found
Content-ID: 1
Content-Type: application/json; charset=utf-8

{"Message":"No HTTP resource was found that matches the request URI 'http://localhost:55802/odata/odata/TodoItems'.","MessageDetail":"No type was found that matches the controller named 'odata'."}
--changesetresponse_7915c1a7-3901-445f-b8bc-12cc49605dec--
--batchresponse_7e404dc1-7370-4f23-a33f-95e50da07c96--

Less full-featured app available?

zza-node-mongo looks like a full-featured application, which is a great reference, but I wonder if there's an alternate 'minimal' application which might be really valuable too, where it does nothing more than demonstrate accessing, querying and saving using Node and MongoDB with the minimum of UI.

A minimal app, maybe not even SPA would help me filter out the 33 javascript files referenced in the index.html file alone, and identify which ones are truly fundamental to using the breeze API. Alternatively an app which incrementally demonstrates the progression from using Breeze with Mongodb in a simple and raw form, through using it with angular, through using it with angular and bootstrap, through adding SPA routing etc. etc. but maybe something much simpler than Zza! even when it's complete.

I'm sure I'm going to learn a lot from this app, but I fear a large majority of my time will be learning about the overall architectural strategy you've chosen, as well as the application details, rather than the Breeze API itself, which could be somewhat lost among this complexity. Is there a chance of an app which does a lot less, but with the same technologies? Is that already in existence somewhere?

EdmBuilder.cs is missing

The latest checkin added a dependency on a file called EdmBuilder.cs.

But it is not in the source tree.

It should be at:

breeze.js.samples-master\breeze.js.samples-master\net\ODataBreezejsSample\ODataBreezejsSample\App_Start

The OData breeze example will not compile and run in its current state.

DocCode sample fails to resolve breeze references

  1. Download breeze.js.samples-master.zip from GitHub and extract net\DocCode.
  2. Open DocCode.sln in VS2013.
  3. Ctrl+F5.

Result: The breeze javascript library can't be located, and all the unit tests fail.

Workaround: Delete the offending JS files from the DocCode project, remove the Breeze Client NuGet package, and re-add it.

EdmBuilder is missing in BOWA sample

EdmBuilder.cs class is missing in BOWA sample on path breeze.js.samples/net/ODataBreezejsSample/ODataBreezejsSample/App_Start/
but it is referred in WebApiConfig.cs on same folder.

access zza database

on readme.md for node, on OS X, to get mongod to correctly access the zza database,

cd database
unzip zza-mongo-database.zip
mv zza-mongo-database zza
mongod --dbpath zza

Using - SaveBundleToSaveMap

I Tried to use the SaveBundleToSaveMap but I think there is something wrong with this Class..

I call it from my Controller and I always get an "Object reference not set to an instance of an object." Exception..

For Example:

var x = SaveBundleToSaveMap.Convert(saveBundle);

Do you guys have any thoughts about this ?

Unable to locate Lookups message on first try

When I complete the tutorial steps after cloning.. and direct to localhost:3000 it opens successfully but in console says
Unable to locate: Lookups

This message is also shown on the server console. Database console of mongodb on starting server shows a new connection is open.

node/tempHire/server/routes.js line 544 issue

Hi Guys,

I'm a newb, so apologies in advance for protocol breaches here - please tell me how I should be (or not be) doing this in the right way.

I think node/tempHire/server/routes.js line 544
needs to be "res.setHeader("Content-Type", "application/json");"
rather than res.setHeader("Content-Type:", "application/json");

Semi colon removed after "Content-Type"

Thanks,

Dave.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.