rsnext/test/integration/api-support/pages/api/blog/index.js
Lukáš Huvar bd31c5d1b7 Dynamic routes for API (#7629)
* Dynamic routes for API

* New structure

* Change next config

* Refactoring tests

* Fix newline

* Fix tests

* Remove dynamic from config

* Apply suggestions from code review

Co-Authored-By: Joe Haddad <timer150@gmail.com>

* Update index.test.js
2019-06-27 12:01:36 -04:00

7 lines
192 B
JavaScript

export default ({ query, method }, res) => {
if (method === 'POST') {
res.status(200).json([{ title: query.title }])
} else {
res.status(200).json([{ title: 'Cool Post!' }])
}
}