localmed / api-mock Goto Github PK
View Code? Open in Web Editor NEWCreates a mock server based on an API Blueprint
License: MIT License
Creates a mock server based on an API Blueprint
License: MIT License
We use gulp to build. Our gulpfile does a require('api-mock') and the require fails as gulp is unable to find the api-mock module.
Here's a gist that shows the problem.
https://gist.github.com/lakshmi-kannan/0af4f390acebda546ef8
Problem #1:
lib/ directory isn't present. package.json specifies main to be lib/api-mock.js. I think this explains why require fails for gulp.
I locally changed main to point to api-mock but that requires things from lib too. I can manually download the src and fix it locally but this is less ideal for us since we do CI. It looks like one possible solution is to check in the lib directory but I am not sure about the implications of coffee scripts and its compiles. I am more than happy to help make the fix. I just don't know what the ideal fix is. Please help.
hey, would be nice to have CORS
support in the mock, what do u think?
It would be cool to have the api mock server watch the file for changes so I don't need to restart it all the time while working on my blueprint.
Hello
I want to parse my API blueprint file, but my language is Chinese.
So I can't mock it, and not show error message.
I was wondering if there was some way to integrate something like nodemon and forever to allow the server to hot-reload when updating the markdown document?
Hi everyone,
Does anyone know if it's possible to serve up multiple API Blueprints with api-mock (other than concatenating them all together)?
Thanks,
Rob
tmackandeMacBook-Pro:API_document tmackan$ npm install api-mock
(node:6412) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[email protected] install /Users/tmackan/PycharmProjects/jiangjie/API_document/node_modules/api-mock/node_modules/protagonist
node-gyp rebuild
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o
LIBTOOL-STATIC Release/markdownparser.a
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HTTP.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSON.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONOneOfParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONTypeSectionParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONValueMemberParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Blueprint.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/BlueprintSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Section.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Signature.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/snowcrash.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/UriTemplateParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HeadersParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/posix/RegexMatch.o
LIBTOOL-STATIC Release/snowcrash.a
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o
LIBTOOL-STATIC Release/sundown.a
CXX(target) Release/obj.target/libdrafter/drafter/src/drafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/cdrafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/Serialize.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeAST.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeSourcemap.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeResult.o
CXX(target) Release/obj.target/libdrafter/drafter/src/RefractAPI.o
CXX(target) Release/obj.target/libdrafter/drafter/src/RefractDataStructure.o
CXX(target) Release/obj.target/libdrafter/drafter/src/RefractSourceMap.o
CXX(target) Release/obj.target/libdrafter/drafter/src/Render.o
CXX(target) Release/obj.target/libdrafter/drafter/src/NamedTypesRegistry.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/Element.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/VisitorUtils.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/SerializeCompactVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/SerializeVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/ComparableVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/TypeQueryVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/IsExpandableVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/ExpandVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/RenderJSONVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/PrintVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/JSONSchemaVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/ApplyVisitor.o
CXX(target) Release/obj.target/libdrafter/drafter/src/refract/Registry.o
LIBTOOL-STATIC Release/drafter.a
CXX(target) Release/obj.target/libsos/drafter/ext/sos/src/sos.o
LIBTOOL-STATIC Release/sos.a
CXX(target) Release/obj.target/protagonist/src/annotation.o
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
In file included from ../../nan/nan.h:182:
../../nan/nan_maybe_43_inl.h:221:17: warning: 'CloneElementAt' is deprecated
[-Wdeprecated-declarations]
return array->CloneElementAt(GetCurrentContext(), index);
^
/Users/tmackan/.node-gyp/6.9.2/include/node/v8.h:3032:36: note:
'CloneElementAt' has been explicitly marked deprecated here
MaybeLocal CloneElementAt(Local context,
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
In file included from ../../nan/nan.h:188:
In file included from ../../nan/nan_new.h:189:
../../nan/nan_implementation_12_inl.h:40:29: warning: 'New' is deprecated
[-Wdeprecated-declarations]
return v8::BooleanObject::New(value).Asv8::BooleanObject();
^
/Users/tmackan/.node-gyp/6.9.2/include/node/v8.h:4007:56: note: 'New' has been
explicitly marked deprecated here
V8_DEPRECATED("Pass an isolate", static Local New(bool value));
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../../nan/nan.h:590:20: error: no type named 'GCEpilogueCallback' in
'v8::Isolate'
v8::Isolate::GCEpilogueCallback callback
~~~~~~~~~~~~~^
../../nan/nan.h:596:20: error: no type named 'GCEpilogueCallback' in
'v8::Isolate'
v8::Isolate::GCEpilogueCallback callback) {
~~~~~~~~~~~~~^
../../nan/nan.h:601:20: error: no type named 'GCPrologueCallback' in
'v8::Isolate'
v8::Isolate::GCPrologueCallback callback
~~~~~~~~~~~~~^
../../nan/nan.h:607:20: error: no type named 'GCPrologueCallback' in
'v8::Isolate'
v8::Isolate::GCPrologueCallback callback) {
~~~~~~~~~~~~~^
../../nan/nan.h:1927:15: warning: 'SetAccessor' is deprecated
[-Wdeprecated-declarations]
return obj->SetAccessor(
^
/Users/tmackan/.node-gyp/6.9.2/include/node/v8.h:2751:22: note: 'SetAccessor'
has been explicitly marked deprecated here
bool SetAccessor(Local name,
^
3 warnings and 4 errors generated.
make: *** [Release/obj.target/protagonist/src/annotation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.1.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/tmackan/PycharmProjects/jiangjie/API_document/node_modules/api-mock/node_modules/protagonist
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
[email protected] /Users/tmackan/PycharmProjects/jiangjie/API_document
├── [email protected] extraneous
├── [email protected] extraneous
└── [email protected] extraneous
npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "api-mock"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the protagonist package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs protagonist
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls protagonist
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/tmackan/PycharmProjects/jiangjie/API_document/npm-debug.log
Anyone know the reason why those error happed??THK A LOT
On two different windows boxes
$ npm install -g api-mock
$ api-mock my\test\api.md
info: Enabled Cross-Origin-Resource-Sharing (CORS)
info: Allow-Origin: *
info: Allow-Methods: GET, PUT, POST, PATCH, DELETE, TRACE, OPTIONS
info: Allow-Headers: Origin, X-Requested-With, Content-Type, Accept, Authorization, Referer, Prefer
info: Listening on port 3000
error: [object SourceAnnotation]
undefined
Any ideas?
each time I do a operation that change or create something it would be good for test purposes to accumulate the state of that object
npm install -g api-mock
getting ERRORs
make: *** [Release/obj.target/protagonist/src/annotation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.0.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/api-mock/node_modules/protagonist
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
/usr/local/lib
└── (empty)
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "api-mock"
npm ERR! node v6.9.1
npm ERR! npm v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the protagonist package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs protagonist
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls protagonist
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/xpg/npm-debug.log
npm ERR! code 1
BUT
npm install -g protagonist
can finish installation without errors.
Is it possible to start api-mock from Gulp? It tried this, but it didn't work:
gulp.task ( 'api-mock-server', function () {
var mockServer = new ApiMock ( {
blueprintPath: './path/to/my/blueprint.md',
options: {
port: 5557
}
} );
mockServer.run();
});
When I run this, it's all good:
api-mock ./path/to/my/blueprint.md --port 5557
let's build a new api documentation
## Todo [/api/todo/{todo-id}]
### Get @TODO information [GET]
Get the status relative to todo reource
+ Request
+ Headers
Accept: ...
the {todo-id}
placeholder with the hyphen was not recognized by the api mock server, i get CANNOT GET /api/todo/234234 but with the underscore {todo_id}
it works well.
am i doing something wrong or we just need to add an escape over the placeholder in order to let it work ?
thanks J
Can it run in conjunction with grunt-server on the same port?
How would I fire it up via a gruntTask?
command: sudo install npm -g api-mock
OS: Mac OS 10.9.3
console output:
npm http 200 https://registry.npmjs.org/raw-body/-/raw-body-1.1.2.tgz
npm http 200 https://registry.npmjs.org/batch/-/batch-0.5.0.tgz
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the protagonist package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls protagonist
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "api-mock"
npm ERR! cwd /Users/mashengbo/git/api-blueprint
npm ERR! node -v v0.11.11
npm ERR! npm -v 1.3.25
npm ERR! code ELIFECYCLE
The project needs unit and integration tests to ensure it's working properly.
When install
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.2.0
gyp ERR! command "/usr/local/Cellar/node/6.2.1/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/brunoquaresma/workspace/prototypes/app-example-1/node_modules/protagonist
gyp ERR! node -v v6.2.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
I tried the master branch and got the following error:
module.js:340
throw err;
^
Error: Cannot find module '../lib/parse-package-json'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/usr/local/lib/node_modules/api-mock/bin/api-mock:3:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
any idea how to fix it, please?
Sorry for Windows, but I'm stuck with it.
I wanted to install api-mock via npm and it's getting an error:
$ npm install mock-api-server --save
> [email protected] install C:\cygwin64\home\e.uzureau\dev\<snip>\node_modules\mock-api-server\node_modules\http-sync
> node-gyp rebuild
C:\cygwin64\home\e.uzureau\dev\<snip>\node_modules\mock-api-server\node_modules\http-sync>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gypnpm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the http-sync package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls http-sync
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "mock-api-server" "--save"
npm ERR! cwd C:\cygwin64\home\e.uzureau\dev\<snip>
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm
The closest thread I can find of others with this problem is here:
nodejs/node-gyp#154
(though sadly it hasn't helped to resolve my problem)
Has anyone else had this trouble?
Log below:
$npm install -g api-mock
npm WARN engine [email protected]: wanted: {"node":"~0.10.4"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"5.3.0","npm":"3.3.12"})
/usr/local/bin/api-mock -> /usr/local/lib/node_modules/api-mock/bin/api-mock
> [email protected] install /usr/local/lib/node_modules/api-mock/node_modules/protagonist
> node-gyp rebuild
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o
LIBTOOL-STATIC Release/markdownparser.a
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HTTP.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSON.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONOneOfParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONTypeSectionParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONValueMemberParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Blueprint.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/BlueprintSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Section.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Signature.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/snowcrash.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/UriTemplateParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HeadersParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/posix/RegexMatch.o
LIBTOOL-STATIC Release/snowcrash.a
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o
LIBTOOL-STATIC Release/sundown.a
CXX(target) Release/obj.target/libdrafter/drafter/src/drafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/cdrafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/Serialize.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeAST.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeSourcemap.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeResult.o
LIBTOOL-STATIC Release/drafter.a
CXX(target) Release/obj.target/libsos/drafter/ext/sos/src/sos.o
LIBTOOL-STATIC Release/sos.a
CXX(target) Release/obj.target/protagonist/src/annotation.o
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../../nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
^
../../nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
^
../../nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../../nan/nan.h:672:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/somebody/.node-gyp/5.3.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/somebody/.node-gyp/5.3.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
^
/Users/somebody/.node-gyp/5.3.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../../nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to
'const v8::Local<v8::Object> &' for 1st argument
class Local {
^
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to
'v8::Local<v8::Object> &&' for 1st argument
class Local {
^
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
V8_INLINE Local(S* that)
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../../nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
~~~~~~~~~~~~~~^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/somebody/.node-gyp/5.3.0/include/node/node.h:42:
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/somebody/.node-gyp/5.3.0/include/node/node.h:42:
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/somebody/.node-gyp/5.3.0/include/node/node.h:42:
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/somebody/.node-gyp/5.3.0/include/node/node.h:42:
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/somebody/.node-gyp/5.3.0/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~/~~~~~~~~~~~~~~~~
../../nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
^
../../nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
9 errors generated.
make: *** [Release/obj.target/protagonist/src/annotation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.3.0
gyp ERR! command "/usr/local/Cellar/node/5.3.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/api-mock/node_modules/protagonist
gyp ERR! node -v v5.3.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
/usr/local/lib
└── (empty)
npm ERR! code 1
Getting error 'Segmentation fault: 11 error' after installing api by running 'npm install api-mock' and run through gulp using gulp.task('api',function()
{
var mockServer=new mockApi({
blueprintPath:files.apiPath,
options:{port:3000}
});
mockServer.run();
})
Add support for HTTP OPTIONS request & response defined in API Blueprint.
Pretty cool so far, just api-mock doesn't understand schema and will send a response regardless of the schema.
### Method [POST]
+ Request 200 (application/json)
+ Schema
{
"type": "object",
"required": true,
"properties": {
"name": {
"type": "string",
"required": true
}
}
}
I try to install api-mock
and failed.
Env
$ node -v
v4.1.2
$ npm -v
2.14.4
Error log:
$ npm install -g api-mock
npm WARN engine [email protected]: wanted: {"node":"~0.10.4"} (current: {"node":"4.1.2","npm":"2.14.4"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.1.2","npm":"2.14.4"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.1.2","npm":"2.14.4"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.1.2","npm":"2.14.4"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.1.2","npm":"2.14.4"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"4.1.2","npm":"2.14.4"})
> [email protected] install /Users/azu/.nodebrew/node/v4.1.2/lib/node_modules/api-mock/node_modules/protagonist
> node-gyp rebuild
2015-10-09 12:10:08.389 xcodebuild[3957:5016371] [MT] PluginLoading: Required plug-in compatibility UUID 0420B86A-AA43-4792-9ED0-6FE0F2B16A13 for plug-in at path '~/Library/Application Support/Developer/Shared/Xcode/Plug-ins/AdjustFontSize.xcplugin' not present in DVTPlugInCompatibilityUUIDs
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownNode.o
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/MarkdownParser.o
LIBTOOL-STATIC Release/markdownparser.a
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HTTP.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSON.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONOneOfParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONTypeSectionParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/MSONValueMemberParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Blueprint.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/BlueprintSourcemap.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Section.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/Signature.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/snowcrash.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/UriTemplateParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/HeadersParser.o
CXX(target) Release/obj.target/libsnowcrash/drafter/ext/snowcrash/src/posix/RegexMatch.o
LIBTOOL-STATIC Release/snowcrash.a
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/autolink.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/buffer.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/markdown.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/src_map.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/src/stack.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_href_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/houdini_html_e.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html.o
CC(target) Release/obj.target/libsundown/drafter/ext/snowcrash/ext/markdown-parser/ext/sundown/html/html_smartypants.o
LIBTOOL-STATIC Release/sundown.a
CXX(target) Release/obj.target/libdrafter/drafter/src/drafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/cdrafter.o
CXX(target) Release/obj.target/libdrafter/drafter/src/Serialize.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeAST.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeSourcemap.o
CXX(target) Release/obj.target/libdrafter/drafter/src/SerializeResult.o
LIBTOOL-STATIC Release/drafter.a
CXX(target) Release/obj.target/libsos/drafter/ext/sos/src/sos.o
LIBTOOL-STATIC Release/sos.a
CXX(target) Release/obj.target/protagonist/src/annotation.o
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../node_modules/nan/nan.h:261:25: error: redefinition of '_NanEnsureLocal'
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
^
../node_modules/nan/nan.h:256:25: note: previous definition is here
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) {
^
../node_modules/nan/nan.h:661:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../node_modules/nan/nan.h:672:12: error: no matching function for call to 'New'
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
^~~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from 'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/azu/.node-gyp/4.1.2/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *') would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/azu/.node-gyp/4.1.2/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
^
/Users/azu/.node-gyp/4.1.2/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3 were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../node_modules/nan/nan.h:676:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
return node::Buffer::New(v8::Isolate::GetCurrent(), size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
^
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
^
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against 'v8::MaybeLocal<v8::Object>'
V8_INLINE Local(S* that)
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:6:
../node_modules/nan/nan.h:683:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
~~~~~~~~~~~~~~^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/azu/.node-gyp/4.1.2/include/node/node.h:42:
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Primitive *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:414:12: note: in instantiation of function template specialization 'v8::Local<v8::Primitive>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::Undefined(v8::Isolate::GetCurrent())));
^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/azu/.node-gyp/4.1.2/include/node/node.h:42:
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Boolean *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:424:12: note: in instantiation of function template specialization 'v8::Local<v8::Boolean>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(v8::True(v8::Isolate::GetCurrent())));
^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/azu/.node-gyp/4.1.2/include/node/node.h:42:
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Function *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1514:12: note: in instantiation of function template specialization 'v8::Local<v8::Function>::Local<v8::Value>' requested here
return NanEscapeScope(NanNew(handle)->Get(kCallbackIndex)
^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
In file included from ../src/annotation.cc:1:
In file included from ../src/protagonist.h:4:
In file included from /Users/azu/.node-gyp/4.1.2/include/node/node.h:42:
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:221:5: error: assigning to 'v8::Object *volatile' from incompatible type 'v8::Value *'
TYPE_CHECK(T, S);
^~~~~~~~~~~~~~~~
/Users/azu/.node-gyp/4.1.2/include/node/v8.h:180:37: note: expanded from macro 'TYPE_CHECK'
*(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \
^ ~~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:1632:12: note: in instantiation of function template specialization 'v8::Local<v8::Object>::Local<v8::Value>' requested here
return NanEscapeScope(handle->Get(NanNew(key)).As<v8::Object>());
^
../node_modules/nan/nan.h:398:30: note: expanded from macro 'NanEscapeScope'
# define NanEscapeScope(val) scope.Escape(_NanEnsureLocal(val))
^
9 errors generated.
make: *** [Release/obj.target/protagonist/src/annotation.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/azu/.nodebrew/node/v4.1.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack at emitTwo (events.js:87:13)
gyp ERR! stack at ChildProcess.emit (events.js:172:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/Users/azu/.nodebrew/node/v4.1.2/bin/node" "/Users/azu/.nodebrew/node/v4.1.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/azu/.nodebrew/node/v4.1.2/lib/node_modules/api-mock/node_modules/protagonist
gyp ERR! node -v v4.1.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/azu/.nodebrew/node/v4.1.2/bin/node" "/Users/azu/.nodebrew/current/bin/npm" "install" "-g" "api-mock"
npm ERR! node v4.1.2
npm ERR! npm v2.14.4
npm ERR! code ELIFECYCLE
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the protagonist package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls protagonist
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
I run api-mock as sub app of my web.
In nginx:
location /mock {
proxy_pass http://127.0.0.1:3000;
And in .md file
# GET /message
+ Response 200 (text/plain)
Hello World!
Then, it fails to fetch mydomain.com/mock/message.
I know I could add /mock/ to all the URLs in the .md file like #GET /mock/message. But that would be inflexible when I want to change the url prefix to /api/v1, for example.
Is there a way to add this common url prefix by api-mock?
This repository fails on install for now and the original maintainers of this seems not able to resolve issues ATM. I recommend that new collaborators shall be added, or this repository's ownership to be transferred.
Just updated my api-mock to the latest one and I am now getting this when starting it.
api-mock\lib\api-mock.js:64:29
walker(app, ast_json['resourceGroups']);
Allowing a user to configure the host name would make it much easier to switch between dev environment testing and qa/production without having to change hostnames in the actual codebase. I don't currently see a way to do this.
Hi,
I am unsure which forum discusses such issues. I am looking for a tutorial to get a my Rest API specified and mocked using NodeJS.
But now I get this. This seems to be an incredible powerful tool for my development team. Can i get a quick tutorial ? I should be able to use the Git code. Right ?
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35
","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.35"
,"npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.1
0.35","npm":"1.4.28"})
Thanks,
Mohan
/usr/local/bin/api-mock -> /usr/local/lib/node_modules/api-mock/bin/api-mock
[email protected] install /usr/local/lib/node_modules/api-mock/node_modules/protagonist
node-gyp rebuild
CXX(target) Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make: *** [Release/obj.target/libmarkdownparser/drafter/ext/snowcrash/ext/markdown-parser/src/ByteBuffer.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:194:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.5.0
gyp ERR! command "/usr/local/Cellar/node/7.8.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/api-mock/node_modules/protagonist
gyp ERR! node -v v7.8.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
/usr/local/lib
└── (empty)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the protagonist package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs protagonist
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls protagonist
npm ERR! There is likely additional logging output above.
Something like this would allow us to resolve #1 with code like
myApp.use('/api', apiMock(configuration).app())
When some headers are declared more than once, api-mock only returns the last declaration of that header, and ignores the rest. This is not correct behaviour, as according to the related RFC a server should support sending multiple values for a header, if and only if that header's values are declared as a comma-separated list.
In this scenario, api-mock should either:
This is related to the following issue: apiaryio/snowcrash#75
Hi,
The following is my api blueprint file.
FORMAT: 1A
# Sample Heading
Sample info
## Endpoint 1 [/sample]
### Create endpoing [POST]
+ Request A (application/json)
{
"test": "v1"
}
+ Response 201 (application/json)
+ Body
{
"test": "v1"
}
+ Request B (application/json)
{
"test": "v2"
}
+ Response 422 (application/json)
+ Body
{
"test": "invalid choice"
}
This is my test code
import requests
url = "http://localhost:3000/sample/"
print requests.post(url, data={"test":"v1"}).json()
print requests.post(url, data={"test":"v2"}).json()
Response 422 is not considered in this case. Both the requests return the response related to Request A (Response 201).
Could you please tell me if there is any error in my api blueprint document (I tried validating it it apiary.io. The doc was validated there) and if api mock supports multiple transactions (As given in blueprint docs).
Thanks a lot 😄
Is there a way to make api-mock respond differently to requests with different query params.
For example, make
http://mydomain/resource?type=b
respond differently to
http://mydomain/resource?type=a
Is this possible?
Nice to have feature: Generating shell script with curl requests from markdown apiary description.
Base URL can be parametrized.
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.