This is test task for Node.js
Create http-server on base framework koa2 with this requirments:
- Work with MySQL. In db contain table books with 1e5 records. Work with clear SQL, not a ORM or Query Builder
- Contains 3 controlers:
- Add records to db
- Return data. Need sort and filtering in any field with offset and limit
- Change
INSTALL
- git clone https://github.com/Alex-cyber-lab/test.git
- set params to "my_sql_connection" in "config/default.json"
- start command "node app.js"
- follow the console instructions
API Path - "/books"
Method - GET Query parameters example:
- where: {"title":"The Odyssey 66"} // For where using 1 field (title, author, description, image)
- date: {"from":"2000-01-21","to":"2005-07-22"} // Date only ISO8601
- orderby: {"id":"ASC","title":"DESC"} // Any fields
- offset: 0 *
- limit: 10 *
Method - POST Body form-data example:
- title: "Book title" *
- date: "2028-08-20" *
- author: "Author name" *
- description: "This book is published..." *
- image: "set path to default png image" *
Method - PUT Body form-data example:
- id: 1 *
- title: "Book title"
- date: "2028-08-20"
- author: "Author name"
- description: "This book is published..."
- image: "set path to default png image"
(*) - required field