putan / stubon Goto Github PK
View Code? Open in Web Editor NEWstubon is simple dummy api server.
License: MIT License
stubon is simple dummy api server.
License: MIT License
e.g.
'/aaa/get':
-
request:
method: 'GET'
queries:
type: '{TYPE_A|TYPE_B}' <- match 'TYPE_A' or 'TYPE_B'
response:
status: 200
body:
result: 'OK! aaa!'
I want to be able to use the setting file written in javascript
e.g.
const message = 'hoge';
export default {
'/hoge' : [
request: {
method: 'GET',
},
response: {
status: 200,
body: {
result: [
{ id: 1, msg: message }, // can use variables.
{ id: 2, msg: message },
],
},
},
],
};
https://github.com/putan/stubon/blob/master/src/stubon.js#L325
change parseInt to parseFloat.
__dirnameで上手く繋ぐ。
OPTIONSの場合は、access-control-request-method に元のメソッドがあるのでそれに置き換えてチェックする
Difficult to understand
Now I cut corners using "deep-diff".
I will implement it myself, because I can not do fine-tuning.
e.g.
If the value is '*' in the string, check only the existence of the key and make it a match.
'/aaa/get/{id}':
-
request:
method: 'GET'
params:
id: '*' <- match any id, but if there is no "id", it will be mismatch.
response:
status: 200
body:
result: 'OK! aaa!'
I want to monitor the setting file and reflect it immediately when there is a change.
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, *');
を追加する。
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.