setup express boilerplate

This commit is contained in:
2025-11-14 17:40:10 -06:00
parent 072b15f3fd
commit e60c8a335c
4 changed files with 36 additions and 1 deletions
+1
View File
@@ -1 +1,2 @@
node_modules/
.env
+12
View File
@@ -0,0 +1,12 @@
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';
export default defineConfig({
out: './drizzle',
schema: './src/db/schema.ts',
dialect: 'postgresql',
dbCredentials: {
url: process.env.DATABASE_URL!,
},
});
+1 -1
View File
@@ -4,7 +4,7 @@
"description": "rdumb-blog backend with expressts and drizzle orm",
"main": "src/index.ts",
"scripts": {
"test": "exit 0"
"start": "npx tsx --env-file=.env --watch src/index.ts"
},
"author": "Roy Dumblauskas",
"license": "ISC",
+22
View File
@@ -0,0 +1,22 @@
import 'dotenv/config';
import { drizzle } from 'drizzle-orm/node-postgres';
import express, { Request, Response } from "express";
// Create a connection to the database
const db = drizzle(process.env.DATABASE_URL!);
// Create a new express application instance
const app = express();
// Set the network port
const port = process.env.PORT || 3000;
// Define the root path with a greeting message
app.get("/", (req: Request, res: Response) => {
res.json({ message: "Welcome to the Express + TypeScript Server!" });
});
// Start the Express server
app.listen(port, () => {
console.log(`The server is running at http://localhost:${port}`);
});