danwahlin / angular-restfulservice Goto Github PK
View Code? Open in Web Editor NEWExample of Angular calling into a RESTful service
Example of Angular calling into a RESTful service
No seed data loaded when running with Docker (mac). Both mongo and nodeapp appear to be running successfully but no db entries displayed, nor am I able to add new entries. Terminal output snippet:
mongodb | 2017-10-01T01:31:36.148+0000 I INDEX [conn1] build index on: customermanager.customers properties: { v: 2, key: { id: 1, type: 1 }, name: "id_1_type_1", ns: customermanager.customers", background: true } mongodb | 2017-10-01T01:31:36.150+0000 I INDEX [conn1] build index done. scanned 0 total records. 0 secs nodeapp | *** customers nodeapp | *** accessDB.getCustomers nodeapp | Customers count: 0 nodeapp | *** customers ok nodeapp | *** customers nodeapp | *** accessDB.getCustomers
Started the site via npm start and it seems to load everything fine and starts the server. However, when I navigate to the site it just spins and never loads in the browser.
I was able to start the app using npm start, and DB seeder loads and everything good,
When launching the application in chrome browser the
Index.html is not able to identify the following js files and it stays in loading in chrome browser
<script src="lib/shim.min.js"></script>
<script src="lib/zone.js"></script>
<script src="lib/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
Following is the error in chrome console.
shim.min.js:1 Uncaught SyntaxError: Unexpected token <
zone.js:1 Uncaught SyntaxError: Unexpected token <
system.src.js:1 Uncaught SyntaxError: Unexpected token <
systemjs.config.js:50 Uncaught ReferenceError: System is not defined
at systemjs.config.js:50
at systemjs.config.js:61
(anonymous) @ systemjs.config.js:50
(anonymous) @ systemjs.config.js:61
(index):22 Uncaught ReferenceError: System is not defined
at (index):22
(anonymous) @ (index):22
Hi Dan,
If I need to make new requests to this.dataService.getCustomersSummary() as the user types a value to filter in a Textbox, do I need to execute the same expression again or will it be different?
this.dataService.getCustomersSummary()
.subscribe((data: ICustomer[]) => this.customers = data);
https://github.com/DanWahlin/Angular-RESTfulService/blob/master/app/customers/customers.component.ts
Hi,
I watched your great course Play by Play: Docker for Web Developers with John Papa and Dan Wahlin
(thank you very much for that), but when I try to run docker-compose on my machine i receive Error
Error: Cannot find module '/var/www/angular2restfulservice/server.js'
I run on Windows 10 and docker version Docker version 1.12.1, build 23cf638
.
When I run docker-compose build
I receive
D:\Projekty\AngularJs\2.0\Angular2-RESTfulService>docker-compose build
Building node
Step 1 : FROM node:latest
---> f4e366168fa6
Step 2 : MAINTAINER Dan Wahlin
---> Using cache
---> a1bf869433e1
Step 3 : ENV CONTAINER_PATH /var/www/angular2restfulservice
---> Using cache
---> 1e7e0e827ce7
Step 4 : WORKDIR $CONTAINER_PATH
---> Using cache
---> bcf8205100a6
Step 5 : RUN npm install supervisor -g
---> Using cache
---> 77dfb9ab1e02
Step 6 : EXPOSE 3000
---> Using cache
---> 59d97e39063c
Step 7 : ENTRYPOINT supervisor server.js
---> Using cache
---> 4738f4d91ab0
Successfully built 4738f4d91ab0
mongodb uses an image, skipping
so it seams that everything is ok, but when I run docker-compose up
I got this
D:\Projekty\AngularJs\2.0\Angular2-RESTfulService>docker-compose up
Creating mongodb
Creating nodeapp
Attaching to nodeapp, mongodb
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] MongoDB starting : pid=1 port=27017 dbpath=/data/db 64-bit host=4a53d36eb356
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] db version v3.2.9
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] allocator: tcmalloc
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] modules: none
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] build environment:
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] distmod: debian81
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] distarch: x86_64
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] target_arch: x86_64
�[33mmongodb |�[0m 2016-09-23T22:08:23.799+0000 I CONTROL [initandlisten] options: {}
�[33mmongodb |�[0m 2016-09-23T22:08:23.803+0000 I STORAGE [initandlisten] wiredtiger_open config: create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_base=false,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=snappy),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2GB),statistics_log=(wait=0),
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Running node-supervisor with
�[36mnodeapp |�[0m program 'server.js'
�[36mnodeapp |�[0m --watch '.'
�[36mnodeapp |�[0m --extensions 'node,js'
�[36mnodeapp |�[0m --exec 'node'
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Starting child process with 'node server.js'
�[36mnodeapp |�[0m Watching directory '/var/www/angular2restfulservice' for changes.
�[36mnodeapp |�[0m Press rs for restarting the process.
�[33mmongodb |�[0m 2016-09-23T22:08:23.906+0000 I FTDC [initandlisten] Initializing full-time diagnostic data capture with directory '/data/db/diagnostic.data'
�[33mmongodb |�[0m 2016-09-23T22:08:23.907+0000 I NETWORK [HostnameCanonicalizationWorker] Starting hostname canonicalization worker
�[36mnodeapp |�[0m module.js:457
�[36mnodeapp |�[0m throw err;
�[36mnodeapp |�[0m ^
�[36mnodeapp |�[0m
�[36mnodeapp |�[0m Error: Cannot find module '/var/www/angular2restfulservice/server.js'
I do not understated why project code is not available in /var/www/angular2restfulservice/server.js
folder. Thank you for your help in fixing this.
Not sure how the data gets loaded per the instructions on the readme page. I don't see anywhere data is being imported. I've tried localhost in the config as well. No joy.
I'm getting the following Windows Error 3 message whenever I attempt the "docker-compose build" command.
Here the output error message.
$ docker-compose build
Building node
Traceback (most recent call last):
File "<string>", line 3, in <module>
File "compose\cli\main.py", line 61, in main
File "compose\cli\main.py", line 113, in perform_command
File "compose\cli\main.py", line 219, in build
File "compose\project.py", line 300, in build
File "compose\service.py", line 727, in build
File "site-packages\docker\api\build.py", line 54, in build
File "site-packages\docker\utils\utils.py", line 103, in tar
File "tarfile.py", line 2006, in add
File "tarfile.py", line 1878, in gettarinfo
WindowsError: [Error 3] The system cannot find the path specified: 'C:\\projects\\Angular2-RESTfulService\\node_modules\\systemjs-builder\\node_modules\\babel-plugin-transform-cjs-system-wrapper\\node_modules\\babel-template\\node_modules\\babel-traverse\\node_modules\\babel-code-frame\\node_modules\\chalk\\node_modules\\ansi-styles\\package.json'
docker-compose returned -1
I am unable to load the seed data ?
I can see the following 2 lines being printed from config loader :
console.log('Node environment: ' + env);
console.log('loading config.' + env + '.json');
I have mongodb up and running and mongoose installed.
Do i have to create the customermanager first or something ?.
Strugling with making it work with docker-compose.
using Docker toolbox on win7, docker 1.13
Nodeapp is exiting. I think the problem is because VOLUME puts in node-modules from WIN-nodejs which doesnt work in container.
Should be npm install in nodeapp dockerfile and move server.js and PUBLIC to some DEV folder to set it as the VOLUME
Daniel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.