Security News
CISA Brings KEV Data to GitHub
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
leonardojs
Advanced tools
npm
$ npm install leonardojs
bower
$ bower install leonardo
<!DOCTYPE HTML>
<html>
<body>
//.....
<script src="[bower_componenets|node_modules|other]/leonardo/dist/leonardo.js"></script>
</body>
</html>
** If your app is running angularjs 1.x you will also need to add the Leonardo module as a dependency
<!DOCTYPE HTML>
<html>
<body ng-app="app">
//.....
<script>
var myApp = angular.module("app", ["leonardo"]);
//.....
</script>
</body>
</html>
You should now see Leonardo's icon on the bottom left corner. Start mocking your ajax calls by using the UI or the API
//.....
Leonardo.addStates([
{
name: 'Get Data',
url: '/api/user/43435',
verb: 'GET',
options: [
{name: 'success', status: 200, data: { name: "Master Splinter" }},
{name: 'error 500', status: 500},
{name: 'error 401', status: 401}
]
},
{
name: 'Update Data',
url: '/api/user/43435',
verb: 'PUT',
options: [
{name: 'success', status: 200},
{name: 'error 500', status: 500},
{name: 'error 400', status: 400}
]
}
]);
Activates state option, mocked response will be returned when calling the state url
//.....
Leonardo.activateStateOption('Update Data', 'success');
$http.put('/api/user/43435', { name: "Master Splinter" }).success(function(data, status) {
console.log(status); // 200
});
Leonardo.activateStateOption('Update Data', 'error 500');
$http.put('/api/user/43435', { name: "Master Splinter" }).error(function(data, status) {
console.log(status); // 500
});
//.....
Deactivates a specific state, when calling the state url request will pass through to the server
//.....
Leonardo.deactivateState('Update Data');
//.....
You can hide Leonardo activator icon by clicking ctrl
+ shift
+ l
.
cd
into the project folder
npm install
gulp build
gulp serve
This will run the demo app (and auto-refresh the browser)
Copyright © 2015 MIT License
FAQs
Leonardo - Your mocking ninja - an add-on tool for centralizing your client side mocking
The npm package leonardojs receives a total of 102 weekly downloads. As such, leonardojs popularity was classified as not popular.
We found that leonardojs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.