Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fredyzz/learn_expressjs_v1
https://github.com/fredyzz/learn_expressjs_v1
Last synced: 2 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/fredyzz/learn_expressjs_v1
- Owner: fredyzz
- Created: 2024-10-18T14:51:28.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-11T06:19:20.000Z (8 days ago)
- Last Synced: 2024-11-11T07:23:43.971Z (8 days ago)
- Language: TypeScript
- Size: 140 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# learn_expressJS_v1
## Commands
To start DDBB docker container:
```bash
docker start postgresql-test
```To start server:
```bash
npm run dev
```To start server in watch mode, to restart on any code change:
```bash
npm run dev:watch
```## How to run Postgres DDBB localy with docker
```bash
docker run --name postgresql-test \
-e POSTGRES_USER=myuser \
-e POSTGRES_PASSWORD=mypassword \
-e POSTGRES_DB=mydatabase \
-p 5432:5432 \
-v my_postgres_data:/var/lib/postgresql/data \
-d postgres
```**This should be the connection string:**
postgresql://myuser:mypassword@localhost:5432/mydatabase## How to execute a Prisma DDBB migration
```bash
npx prisma migrate dev --name init
```## Start Prisma Studio
```bash
npx prisma studio
```## Run jest configurator
```bash
npx ts-jest config:init
```## Testing the APIs
A ThunderClient collection is included in the repository, it can be imported and used in the VSCODE ThunderClient extension.
## Used in this project
[Morgan](https://github.com/expressjs/morgan) - HTTP request logger middleware for node.js
[Prisma](https://github.com/prisma/prisma) - ORM.
[Express validator](https://www.npmjs.com/package/express-validator) - Validation tool for handlers
[Supertest](https://www.npmjs.com/package/supertest) - High-level abstraction for testing HTTP, while still allowing you to drop down to the lower-level API provided by superagent.
[Jest](https://jestjs.io/) - JavaScript Testing Framework with a focus on simplicity.