vladvelici / ng2-mock-server Goto Github PK
View Code? Open in Web Editor NEWA mock HTTP server for angular2 that runs in the browser. Front-end dev when the backend is missing.
License: MIT License
A mock HTTP server for angular2 that runs in the browser. Front-end dev when the backend is missing.
License: MIT License
i'm not 100% sure this is a bug in this code, but it seems to be. Consider a call chain like:
let log = console.log.bind(console);
let error = console.error.bind(console);
let warn = console.warn.bind(console);
this.httpService.get(...).subscribe(log, error, warn)
when using this mock, the 3rd (onComplete) callback is not consistently called (only rarely, and i am not certain under which conditions). When not using the mock, it is triggered consistently after the first callback (but apparent;y not if the onError callback is called).
I have the following when I try to install ng2-mockup-server
:
npm install ng2-mock-server --save-dev
├─┬ [email protected]
│ ├── UNMET PEER DEPENDENCY @angular/[email protected]
│ ├── UNMET PEER DEPENDENCY @angular/[email protected]
│ └── UNMET PEER DEPENDENCY @angular/[email protected]
└── UNMET PEER DEPENDENCY [email protected]
Btw, here are my project's dependencies :
"dependencies": {
"@angular/common": "^2.4.0",
"@angular/compiler": "^2.4.0",
"@angular/core": "^2.4.0",
"@angular/forms": "^2.4.0",
"@angular/http": "^2.4.0",
"@angular/platform-browser": "^2.4.0",
"@angular/platform-browser-dynamic": "^2.4.0",
"@angular/router": "^3.4.0",
"@ngx-translate/core": "^6.0.0",
"@ngx-translate/http-loader": "0.0.3",
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.4.1",
"ng2-mock-server": "0.0.3",
"rxjs": "^5.1.0",
"zone.js": "^0.7.6"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.32.3",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "~6.0.60",
"codelyzer": "~2.0.0-beta.4",
"css-loader": "^0.26.2",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"ng2-mock-server": "0.0.3",
"protractor": "~5.1.0",
"style-loader": "^0.13.2",
"ts-node": "~2.0.0",
"tslint": "~4.4.2",
"typescript": "~2.0.0"
}
Do you have any idea about these errors ?
Maybe ng2-mockup-server
dependencies need to be upgraded.
I aleady build and link the module ,but still get error
I know why , neet to run npm link ng2-mock-server
Hi!
we were unable to get ng2-mock-server running as a node module (and unable to figure out why, because none of us know much of anything about node), but we have since integrated it directly, as-is into our source tree and it's working great. We have replaced json-server with your mock because it's far simpler for our development workflow (no need for a second server process).
i'm trying to upgrade us from angular2 beta-12 (14?) to rc.1 and had to make the following changes to your code (unfortunately i have no diff, but the changes were minimal):
all of the modules were renamed: 'angular2/xxx' ==> '@angular/xxx'. A couple require more notable changes, but i don't recall what they are off-hand :/.
the http module has to be loaded separately in package.json:
"@angular/http": "2.0.0-rc.1",
most notably, i had to change this import from mocksrv.service.ts:
import {Connection, ConnectionBackend} from '@angular/http/src/interfaces';
(http/src/interfaces uses to be in the main a2 module)
After that, broccoli compiles it :). i still haven't gotten our tree to the point where i can actually try that out, but it at least compiles.
Thanks for the code!
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.