Setup api and express
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.env
|
||||
1482
api/package-lock.json
generated
Normal file
1482
api/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
api/package.json
Normal file
22
api/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "ecommerce-api",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"license": "ISC",
|
||||
"author": "",
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"dev" : "node --import=tsx --watch --env-file=.env src/index.ts",
|
||||
"build": "tsc"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^5.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.3",
|
||||
"tsx": "^4.20.3",
|
||||
"typescript": "^5.8.3"
|
||||
}
|
||||
}
|
||||
12
api/src/index.ts
Normal file
12
api/src/index.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import express from 'express';
|
||||
|
||||
const app = express();
|
||||
const port = 3000;
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
res.send('Hello World! 123')
|
||||
})
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening on port ${port}`)
|
||||
})
|
||||
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext", // Use ESNext for ESM
|
||||
"target": "ES2020", // Target modern ECMAScript versions
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"outDir": "./dist", // Output directory for compiled files
|
||||
"strict": true, // Enable strict type-checking options
|
||||
"skipLibCheck": true, // Skip type checking of declaration files
|
||||
"resolveJsonModule": true, // Include JSON imports
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": false, // Allow emitting output
|
||||
"isolatedModules": true, // Required for using ESM modules
|
||||
"baseUrl": ".", // Allow absolute imports relative to project root
|
||||
"paths": {
|
||||
"*": ["node_modules/*"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user