From 2e6a0290f2dac15167d571645fc77124920d69b5 Mon Sep 17 00:00:00 2001 From: karishmas6 Date: Thu, 4 Apr 2024 08:58:17 +0530 Subject: [PATCH] chore: fastify + ts api setup --- README.md | 0 {scraper => api}/.gitignore | 0 {scraper => api}/package.json | 5 +++-- {scraper => api}/pnpm-lock.yaml | 0 api/src/index.ts | 20 ++++++++++++++++++++ {scraper => api}/tsconfig.json | 0 scraper/src/index.ts | 0 7 files changed, 23 insertions(+), 2 deletions(-) delete mode 100644 README.md rename {scraper => api}/.gitignore (100%) rename {scraper => api}/package.json (79%) rename {scraper => api}/pnpm-lock.yaml (100%) create mode 100644 api/src/index.ts rename {scraper => api}/tsconfig.json (100%) delete mode 100644 scraper/src/index.ts diff --git a/README.md b/README.md deleted file mode 100644 index e69de29b..00000000 diff --git a/scraper/.gitignore b/api/.gitignore similarity index 100% rename from scraper/.gitignore rename to api/.gitignore diff --git a/scraper/package.json b/api/package.json similarity index 79% rename from scraper/package.json rename to api/package.json index aeec9777..863836c6 100644 --- a/scraper/package.json +++ b/api/package.json @@ -1,10 +1,11 @@ { - "name": "scraper", + "name": "api", "version": "1.0.0", "description": "", "main": "index.js", + "type": "module", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "start": "ts-node src/index.ts" }, "keywords": [], "author": "", diff --git a/scraper/pnpm-lock.yaml b/api/pnpm-lock.yaml similarity index 100% rename from scraper/pnpm-lock.yaml rename to api/pnpm-lock.yaml diff --git a/api/src/index.ts b/api/src/index.ts new file mode 100644 index 00000000..8786d1a1 --- /dev/null +++ b/api/src/index.ts @@ -0,0 +1,20 @@ +import Fastify from 'fastify' + +const fastify = Fastify(); + +fastify.get('/', async (request, reply) => { + return 'Hello there! 👋'; + +}) + +const start = async () => { + try { + await fastify.listen({ port: 8000 }); + console.log('Server listening on port 8000'); + } catch (err) { + console.error(err); + process.exit(1); + } +} + +start(); \ No newline at end of file diff --git a/scraper/tsconfig.json b/api/tsconfig.json similarity index 100% rename from scraper/tsconfig.json rename to api/tsconfig.json diff --git a/scraper/src/index.ts b/scraper/src/index.ts deleted file mode 100644 index e69de29b..00000000