
Research
/Security News
Popular Tinycolor npm Package Compromised in Supply Chain Attack Affecting 40+ Packages
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
copress-explorer
Advanced tools
Browse and test your Sycle app's APIs.
Below is a simple Sycle application. The explorer is mounted at /explorer
.
var sycle = require('sycle');
var express = require('express');
var rest = require('copress-rest');
var explorer = require('../');
var port = 3000;
// create express application
var app = express();
app.disable('x-powered-by');
// create sycle application
var sapp = sycle();
sapp.registry.define('Product', {crud: true});
sapp.phase(sycle.boot.database());
sapp.boot(function (err) { if (err) throw err; });
// setup middlewares
var apiPath = '/api';
app.use('/explorer', explorer(sapp, { basePath: apiPath }));
app.use(apiPath, rest(sapp));
console.log("Explorer mounted at localhost:" + port + "/explorer");
// start server
app.listen(port);
Many aspects of the explorer are configurable.
See options for a description of these options:
// Mount middleware before calling `explorer()` to add custom headers, auth, etc.
app.use('/explorer', basicAuth('user', 'password'));
app.use('/explorer', explorer(sapp, {
basePath: '/custom-api-root',
swaggerDistRoot: '/swagger',
apiInfo: {
'title': 'My API',
'description': 'Explorer example app.'
},
resourcePath: 'swaggerResources',
version: '0.1-unreleasable'
}));
app.use('/custom-api-root', rest(sapp));
Options are passed to explorer(sapp, options)
.
basePath
: String
Default:
'/api'
.
Sets the API's base path. This must be set if you are mounting your api to a path different than '/api', e.g. with `app.use('/custom-api-root', rest(sapp));
swaggerDistRoot
: String
Sets a path within your application for overriding Swagger UI files.
If present, will search
swaggerDistRoot
first when attempting to load Swagger UI, allowing you to pick and choose overrides to the interface. Use this to style your explorer or add additional functionality.
See index.html, where you may want to begin your overrides. The rest of the UI is provided by Swagger UI.
apiInfo
: Object
Additional information about your API. See the spec.
Field Name | Type | Description |
---|---|---|
title | string | Required. The title of the application. |
description | string | Required. A short description of the application. |
termsOfServiceUrl | string | A URL to the Terms of Service of the API. |
contact | string | An email to be used for API-related correspondence. |
license | string | The license name used for the API. |
licenseUrl | string | A URL to the license used for the API. |
resourcePath
: String
Default:
'resources'
Sets a different path for the resource listing. You generally shouldn't have to change this.
version
: String
Default: Read from package.json
Sets your API version. If not present, will read from your app's package.json.
FAQs
Browse and test your Copress app's APIs
We found that copress-explorer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
/Security News
Malicious update to @ctrl/tinycolor on npm is part of a supply-chain attack hitting 40+ packages across maintainers
Security News
pnpm's new minimumReleaseAge setting delays package updates to prevent supply chain attacks, with other tools like Taze and NCU following suit.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.