
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
mares-api-router
Advanced tools
mares presentation layer에서 사용하는 router class 입니다. 반드시 ��우팅 전에 해당 클래��를 상속받아서 사용합니다.
mares presentation layer에서 사용하는 router class 입니다. 반드시 라우팅 전에 해당 클래스를 상속받아서 사용합니다.
npm install --save mares-api-router
GetRouter, PostRouter, DelRouter, PutRouter 가 있으며 사용법은 동일합니다.
먼저 sg-openapi-validator 모듈의 validator 미들웨어를 use 시켜줍니다.
const validator = require('sg-openapi-validator')
app.use(validator())
이후에 다음과 같이 클래스를 정의합니다.
// get.js
const GetRouter = require('mares-api-router').GetRouter;
module.exports = class extends GetRouter {
constructor(url) {
super(url);
}
fetcher() {
return async (req, res, next) => {
try {
next();
} catch (e) {
next(e);
}
};
}
responder() {
return async (req, res) => {
res.success({
row: req.receiver.getObject()
})
}
}
}
마지막으로 express의 router를 이용하여 미들웨어 호출 스택을 정의합니다.
const router = require('express').Router()
const GET = require('./get.js')
const gets = new GET('url')
router.post(
post.getUrl(), // mares-api-router에서 생성자에서 넘긴 url을 가져옵니다.
post.validator(), // mares-api-router의 기본 미들웨어입니다.
post.fetcher(),
post.responder()
)
해당 미들웨어는 api 요청시 들어온 parameter, body 데이터의 유효성을 검사합니다.
반드시 sg-openapi-validator 모듈의 validator 미들웨어를 먼저 use 시켜줘야 합니다.
해당 모듈의 대한 자세한 설명은 문서를 참고하시기 바랍니다.
최종적으로 mares-api-router의 validator 미들웨어에서는
3가지를 수행합니다.
즉 validator 에서는 내부적으로 sg-openapi-validator의 바인딩된 미들웨어를 사용합니다.
FAQs
mares presentation layer에서 사용하는 router class 입니다. 반드시 ��우팅 전에 해당 클래��를 상속받아서 사용합니다.
We found that mares-api-router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.