
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
restyped-express-async-middleware
Advanced tools
Express route wrappers for declaring type-safe APIs with [RESTyped](https://github.com/rawrmaan/restyped). Also supports `async` route functions.
Express route wrappers for declaring type-safe APIs with RESTyped. Also supports async
route functions.
npm install restyped-express-async
It's just like normal express, except you'll need to provide a RESTyped API definition file for the API you want to use, and return a Promise with your response value in order to activate type-checking.
import RestypedRouter from 'restyped-express-async'
import {MyAPI} from './MyAPI' // <- Your API's RESTyped defintion
import * as express from 'express'
const app = express()
const router = RestypedRouter<MyAPI>(app)
// You'll get a compile error if you declare a route that doesn't exist in your API defintion.
router.post('/login', async req => {
// Error if you try to access body properties that don't exist in your API definition.
const {username, password, twoFactorPin} = req.body
// ^ string ^ string ^ number
const accessToken = await User.login(username, password, twoFactorPin)
// Error if you don't return the response type defined in your API defintion.
return accessToken
})
You can throw
from inside your async
function and your thrown error will be passed to next(err)
.
Use express directly to send responses with status codes. Don't forget to return
after you res.send()
.
router.post('/login', async (req, res) => {
const {username, password, twoFactorPin} = req.body
const accessToken = await User.login(username, password, twoFactorPin)
if (!accessToken) {
res.status(401).send()
return
}
return accessToken
})
FAQs
Express route wrappers for declaring type-safe APIs with [RESTyped](https://github.com/rawrmaan/restyped). Also supports `async` route functions.
The npm package restyped-express-async-middleware receives a total of 2 weekly downloads. As such, restyped-express-async-middleware popularity was classified as not popular.
We found that restyped-express-async-middleware 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.