From 798c55108cab79f082217bd97dcdf8fe2ff0d6af Mon Sep 17 00:00:00 2001 From: ChefKai <74599990+ChefKai@users.noreply.github.com> Date: Wed, 3 Feb 2021 17:42:02 +0100 Subject: [PATCH] feat: Time/Version endpoint (#28) --- README.md | 4 ++-- api/{time.ts => version.ts} | 5 ++--- package.json | 4 ++-- vercel.json | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) rename api/{time.ts => version.ts} (64%) diff --git a/README.md b/README.md index ec34da9c..5573c3d6 100644 --- a/README.md +++ b/README.md @@ -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' # ... ``` diff --git a/api/time.ts b/api/version.ts similarity index 64% rename from api/time.ts rename to api/version.ts index 411db561..46de3450 100644 --- a/api/time.ts +++ b/api/version.ts @@ -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 }); }; diff --git a/package.json b/package.json index 3f867238..d0c33a47 100644 --- a/package.json +++ b/package.json @@ -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": "git@github.com:pancakeswap/pancake-profile-api.git", "author": "PancakeSwap", "license": "MIT", diff --git a/vercel.json b/vercel.json index cda59fcb..d1d79485 100644 --- a/vercel.json +++ b/vercel.json @@ -4,7 +4,7 @@ "redirects": [ { "source": "/", - "destination": "/api/time", + "destination": "/api/version", "permanent": true } ],