chore: fastify + ts api setup
This commit is contained in:
0
scraper/.gitignore → api/.gitignore
vendored
0
scraper/.gitignore → api/.gitignore
vendored
@@ -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": "",
|
||||
0
scraper/pnpm-lock.yaml → api/pnpm-lock.yaml
generated
0
scraper/pnpm-lock.yaml → api/pnpm-lock.yaml
generated
20
api/src/index.ts
Normal file
20
api/src/index.ts
Normal 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();
|
||||
Reference in New Issue
Block a user