
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
quick-ex-db-monorepo
Advanced tools
A CLI tool to quickly scaffold an Express.js server with a database
A CLI tool to quickly scaffold an Express.js app with PostgreSQL and Jest.
To install this package globally, run:
npm install -g quick-ex-db
After installation, you can create a new Express app by running:
npx quick-ex-db <project-name>
.env.test
PGDATABASE=your_test_db_name
.env.development
PGDATABASE=your_db_name
Create the first endpoint test in app.test.js:
const request = require("supertest");
const app = require("../app");
describe("GET /endpoint", () => {
it("should respond with 200 status", async () => {
const response = await request(app).get("/endpoint");
expect(response.statusCode).toBe(200);
});
});
Run the test:
npm test
const express = require("express");
const router = express.Router();
const { getExample } = require("../controllers/example-controller.js");
router.get("/example", getExample);
module.exports = router;
const { selectExample } = require("../models/example-model.js");
exports.getExample = (req, res, next) => {
selectExample()
.then((example) => {
res.status(200).send({ example });
})
.catch((err) => {
next(err);
});
};
const db = require("../../db/connection.js");
exports.selectExample = () => {
return db.query("SELECT * FROM example_table").then(({ rows }) => {
return rows;
});
};
createdb <database-name>
copy the URI connection string
- "postgres://...", or keep that tab open as you complete the next step
.Carrying on from before, with the database password and URI both handy:
DATABASE_URL=postgresql://postgres:[YOUR-PASSWORD]@<host>:<port>/postgres
New +
button at the top right.yarn
and the default start command to yarn start
.Environment Variables
section:Key
called DATABASE_URL
using the URI for Value
from your .env.production
fileKey
called NODE_ENV
, set the value
to production
Logs
for it by going to the Events
on the dashboardWhen it's deployed, you can view it via the generated link, upon navigating there you will be greeted with an error, make sure you are pointing to an existing endpoint, such as /api
and confirm your data is being fetched correctly.
I welcome contributions to improve this tool! Here’s how you can help:
If you find a bug or have a feature request, please create an issue on the GitHub repository.
git clone https://github.com/<your-username>/quick-ex-db.git
git checkout -b my-new-feature
git add .
git commit -m "Add my new feature"
git push origin my-new-feature
FAQs
A CLI tool to quickly scaffold an Express.js server with a database
The npm package quick-ex-db-monorepo receives a total of 0 weekly downloads. As such, quick-ex-db-monorepo popularity was classified as not popular.
We found that quick-ex-db-monorepo demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.