Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[now-node] Add NowApiHandler type #4001

Merged
merged 2 commits into from Apr 3, 2020
Merged

[now-node] Add NowApiHandler type #4001

merged 2 commits into from Apr 3, 2020

Conversation

mcansh
Copy link
Contributor

@mcansh mcansh commented Apr 3, 2020

now equivalent of NextApiHandler introduced vercel/next.js#10573

`now` equivalent of `NextApiHandler` introduced vercel/next.js#10573
export type NowApiHandler = (
req: NowRequest,
res: NowResponse
) => void;
Copy link
Member

@styfle styfle Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you create a new file test/fixtures/15-helpers/ts/handler.ts to test this new behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would that be as simple as this?

import { NowApiHandler } from './types';

const listener: NowApiHandler = (req, res) => {
  res.status(200);
  res.send('hello:RANDOMNESS_PLACEHOLDER');
};

export default listener;

@styfle styfle changed the title add NowApiHandler type [now-node] Add NowApiHandler type Apr 3, 2020
Signed-off-by: Logan McAnsh <logan@mcan.sh>
Copy link
Member

@styfle styfle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@styfle styfle merged commit 1ceeac4 into vercel:master Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants