Skip to content

Commit

Permalink
feat: Time/Version endpoint (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChefKai authored Feb 3, 2021
1 parent 180bf2a commit 798c551
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ vercel dev
Endpoints are based on filename inside the `api/` folder.

```shell
# api/time.ts
curl -X GET 'localhost:3000/api/time'
# api/version.ts
curl -X GET 'localhost:3000/api/version'

# ...
```
Expand Down
5 changes: 2 additions & 3 deletions api/time.ts → api/version.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NowRequest, NowResponse } from "@vercel/node";
import { version } from "../package.json";

export default (req: NowRequest, res: NowResponse): void => {
const time = new Date().getTime();

res.json({ time });
res.json({ version });
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "pancake-profile-api",
"version": "1.0.1",
"version": "1.0.2",
"description": "Serverless API implementation for PancakeSwap Profile smart contract on Binance Smart Chain.",
"main": "api/time.ts",
"main": "api/version.ts",
"repository": "[email protected]:pancakeswap/pancake-profile-api.git",
"author": "PancakeSwap",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"redirects": [
{
"source": "/",
"destination": "/api/time",
"destination": "/api/version",
"permanent": true
}
],
Expand Down

1 comment on commit 798c551

@vercel
Copy link

@vercel vercel bot commented on 798c551 Feb 3, 2021

Choose a reason for hiding this comment

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

Please sign in to comment.