c821e83048
* Cookies and Query parsing for API request * Adding JSON and SEND * First body parsing * Body parsing * Remove extra try catch * Fix tests * Only server bundling for API routes * Update packages/next-server/server/api-utils.ts Co-Authored-By: Tim Neutkens <tim@timneutkens.nl> * Revert on demand server changes * Use content-type for parsing * Update packages/next-server/server/api-utils.ts Co-Authored-By: Jan Potoms <potoms.jan@gmail.com> * Add tests for server compilation * Add body limit * Change API to function chaining * Limit test
7 lines
192 B
JavaScript
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!' }])
|
|
}
|
|
}
|