Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@andyburke/fs-fastify
Advanced tools
A module to drive your fastify setup via the filesystem.
const fastify = require( 'fastify' )( {
logger: true
} );
const fs_fastify = require( '@andyburke/fs-fastify' );
const routes = await fs_fastify();
for ( const route of routes ) {
fastify.register( route );
}
fastify.listen( 3000, function ( err, address ) {
if ( err ) {
fastify.log.error( err );
process.exit( 1 );
}
fastify.log.info( `server listening on ${address}` );
} );
This will load all files that match the required options and register them as routes in your fastify server.
For example, you could lay out your files thusly:
./api
foo/
:bar/
GET.js
:baz/
POST.js
zip/
PATCH.js
This would create the following routes:
GET /foo/:bar
POST /foo/:baz
PATCH /foo/zip
Sets the root folder to find routes in. By default this is set to 'api'.
Sets the extensions to search for.
Sets the methods to look for in the file tree. Defaults to all normal HTTP methods.
Your routes should export either a single function, eg:
module.exports = function ( request, reply ) {
return {
hello: "world"
};
};
Or you can export a fastify route object, eg:
module.exports = {
// you should omit the method, as it will be filled by fs-fastify based on
// the filename
// method: 'GET',
// you should omit the url, as it will be filled by fs-fastify based on
// the filename
// url: '/',
schema: {
response: {
200: {
type: 'object',
properties: {
hello: { type: 'string' }
}
}
}
},
handler: function (request, reply) {
reply.send( { hello: 'world' } )
}
};
FAQs
Drive your fastify setup from the filesystem.
The npm package @andyburke/fs-fastify receives a total of 2 weekly downloads. As such, @andyburke/fs-fastify popularity was classified as not popular.
We found that @andyburke/fs-fastify 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.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.