
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@renanlido/serverless-routes-generator
Advanced tools
Minimal package that automates routes creation for serverless applications with using serverless.ts config file
Full starter stack to develop CJS/ESM compatible npm packages with TypeScript, Vitest, ESLint, Prettier, and GitHub Actions.
Introducing serverless-routes-generator – an npm package designed to simplify route creation for Serverless applications. With just a few commands, you can effortlessly generate and manage routes in your serverless.ts file, eliminating the need for manual configuration. Whether you’re building a small project or scaling a complex architecture, serverless-routes-generator streamlines your workflow, allowing you to focus on developing features instead of handling boilerplate setup. Enhance your Serverless development experience today with this intuitive and efficient tool!
npm
npm install @renanlido/serverless-routes-generator
yarn
yarn add @renanlido/serverless-routes-generator
pnpm
pnpm add @renanlido/serverless-routes-generator
serverless-routes-generator init
ps: This command accept the following flags:
-t [type]
: Type of the config file (js, ts, or json). Default is ts.The generated config file will be created based on the specified type (js, ts, or json). Example:
import { type GeneratorConfigFileData } from '@renanlido/serverless-routes-generator'
export const config: GeneratorConfigFileData = {
pathPattern: 'functions/**/handler.ts',
projectRoot: 'src',
generatedFileName: 'serverless-routes',
generatedFileExtension: 'ts',
}
import { createHandler } from "@renanlido/serverless-routes-generator";
export const generatePresignedLink = createHandler(
{
events: [
// all lambda events
{
http: {
method: 'POST',
path: 'example/route',
cors: true,
},
},
],
layers: [
'arn:aws:lambda:region:account-id:layer:layer-name:version'
]
() => {
// Any handler function here
return {
statusCode: 200,
body: JSON.stringify({ message: 'Hello World' }),
}
},
)
{
"scripts": {
"generate-routes": "serverless-routes-generator generate"
}
}
This command will create a file called serverless-routes.ts. Import it into your serverless.ts. That's it!
import { functions } from './serverless-routes'
// ...others configurations
functions: {
...functions,
}
// ...other configurations
git clone git@github.com:renanlido/serverless-routes-generator.git
pnpm install
npm run generate:routes:bin
- Generate the routes.npm run generate:bin:init
- Generate the bin.npm run generate:bin
- Generate the bin.npm run generate:routes
- Generate the routes.npm run link:bin
- Link the package to the global scope.npm run build
- Build the package.npm run type-check
- Check the types.npm run check:fix
- Check and fix the code.npm run validate
- Run the type-check and check:fix scripts.npm run check:exports
- Check the exports.npm run local-release
- Build the package, version it, and publish it locally.Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE.md file for details.
This project was inspired by the need to streamline route management in Serverless applications. Special thanks to the open-source community for their valuable contributions.
FAQs
Minimal package that automates routes creation for serverless applications with using serverless.ts config file
We found that @renanlido/serverless-routes-generator demonstrated a healthy version release cadence and project activity because the last version was released less than 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.