ajoelp / mock-json-server Goto Github PK
View Code? Open in Web Editor NEWA mock web server using a JSON file with live-reload support.
License: MIT License
A mock web server using a JSON file with live-reload support.
License: MIT License
Is it possible to add support for different router to support queering like:
api
would output something else than api?id=1
and something else for api?id=1&user=test
Currently there api?id=1
fall into api
But I cannot force it to different output.
Describe the bug
To Reproduce
Steps to reproduce the behavior:
npm install mock-json-server
mock-json-server ./api.json --port 8080
Expected behavior
app.listen(...)
Desktop:
Additional context
Uses
server = app.listen(port, function() {
callback();
});
in src/server/index.js
to start server, however NodeJS uses host 0.0.0.0 as default (not 127.0.0.1), see https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback
As this is far more better mock-json-server than other I found (ability to overwrite POST) and it simpler for things I need I would love to see path that application is trying to get from this server. Any change to add this ?
Hi,
Do you know how can we configure mock-json-server to support same machine requests?
Currently I ran mock-json-server on port 3000
and angular app on port 8000
I get this error:
angular.js:13531 Access to XMLHttpRequest at 'localhost:3000/sample' from origin 'http://localhost:8000' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
when calling:
$http.get('http://rest-service.guides.spring.io/greeting')
is mock-json-server configurable to disable CORS policy?
Describe the bug
I installed and rand mock-json-server as described in the documentation. However, when I access http://127.0.0.1:8000/, I got some HTML instead of JSON: https://gist.github.com/MCakrt/726803cb6e86f535456a437f32710a68
Furthermore http://127.0.0.1:8000/home does not work, I get "Cannot GET /home"
Expected behavior
I expected mock-json-server to return the JSON file I provided.
Desktop:
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.