노드 API를 개발 중입니다. 끝 점이 있습니다 GET /messages
Express + node.js API 필터링
이 메시지는 모든 메시지를 반환합니다. 나는 필터 문 제가 DB와 ORM과 PostgreSQL과 같은 sequelize를 사용하여이
{fieldName1}={fieldValue1}&...{fieldNameN}>{fieldValueN}.
Operations can be =, > or <. <and> operations are only for number, integers and dates
처럼 될 것
GET /messages?filter=my_filter_string&limit=10&offset=10
처럼이 엔드 포인트 무언가에 페이지 매김을 갖고 싶어. 제 질문은 my_filter_statement를 구문 분석하고이를 sequelize 용 검색 기준 오브젝트로 변환하는 방법입니다. 내가
GET /messages?filter="id=10&contentlength>20"&limit=10&offset=10
좋아 API가
비슷한 문제가 궁금하거나 .. filter = {where : {id : 10}}하지만이 방법이 전혀 안전하지 않을 수도 있습니다. –