chore: fastify + ts api setup

This commit is contained in:
karishmas6
2024-04-04 08:58:17 +05:30
parent 5c07c54b57
commit 2e6a0290f2
7 changed files with 23 additions and 2 deletions

View File

View File

@@ -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": "",

20
api/src/index.ts Normal file
View File

@@ -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();

View File