GithubHelp home page GithubHelp logo

s-hirano-ist / rss-dumper Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 502 KB

Sample REST server

Home Page: https://rest.s-hirano.com

License: MIT License

JavaScript 3.39% TypeScript 96.09% Dockerfile 0.52%

rss-dumper's Introduction

RSS Dumper

Sample Express server for studying backend REST server.

👌 Known Issues and checkpoints

See GitHub issue 186 for more details(?).

💻 Tech Stack

Language - TypeScript
Main Framework - Express
ORM - Prisma
Database - PostgreSQL
Test - Jest
Authentication - Passport
Code Formatting - Prettier
Linting - ESLint
Validation - Joi
Generate Swagger - Tsoa
Validate Swagger - openapi-schema-validator

Render settings

Add following environments

POSTGRES_PRISMA_URL=
POSTGRES_URL_NON_POOLING=
NODE_VERSION=18.17.1
PORT=8080

https://render.com/docs/node-version

Build command (This should change to webpack & pm2 or vite for bundling)

pnpm i

Start command

NODE_ENV=production pnpm start

Use docker

docker compose --profile app up -d

🍾 Initial setups

git clone https://github.com/s-hirano-ist/rss-dumper.git
cd rss-dumper
docker compose up --build -d
pnpm i
pnpm prisma:dev
pnpm tsoa:swagger
pnpm tsoa:routes

API path

  • /api/docs: Swagger UI
  • /health: health
  • /v1/news: Pure REST API
  • /v1/news-detail: REST API with Swagger auto generation with Tsoa

Tests

pnpm test

Curl commands

# GET
curl -s https://rss-dumper.onrender.com/v1/news/
curl -s https://rss-dumper.onrender.com/v1/news/test-a

# POST
curl -s -d '{"heading": "test-a", "description": "test description A"}' -H 'Content-Type: application/json' https://rss-dumper.onrender.com/v1/news/create

# PATCH
curl -s -d '{"description": "updated description"}' -H 'Content-Type: application/json' -X PATCH https://rss-dumper.onrender.com/v1/news/update/test-a

# DELETE
curl -s -X DELETE https://rss-dumper.onrender.com/v1/news/delete/test-a
curl -s -X DELETE https://rss-dumper.onrender.com/v1/news/delete

🪝 Tags & Realease

gh release create --generate-notes

Notes

Sanitization to prevent XSS is done by sanitize-html

No sanitization to prevent SQL injection is needed due to Prisma's prevention.

https://www.prisma.io/docs/concepts/components/prisma-client/raw-database-access#sql-injection

rss-dumper's People

Contributors

renovate[bot] avatar s-hirano-ist avatar

Watchers

 avatar

rss-dumper's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to get an update now.

  • chore(deps): lock file maintenance

Ignored or Blocked

These are blocked by an existing closed PR and will not be recreated unless you click a checkbox below.

Detected dependencies

docker-compose
compose.yml
dockerfile
db.Dockerfile
  • postgres 15-alpine
server.Dockerfile
  • node 20-slim
github-actions
.github/workflows/build.yaml
  • actions/checkout v4
  • actions/setup-node v4
  • pnpm/action-setup v2
  • actions/cache v3
npm
package.json
  • @prisma/client ^5.7.1
  • @tsoa/runtime ^6.0.0
  • body-parser ^1.20.2
  • cors ^2.8.5
  • dotenv ^16.3.1
  • express ^4.18.2
  • joi ^17.11.0
  • passport ^0.7.0
  • passport-http ^0.3.0
  • sanitize-html ^2.11.0
  • swagger-ui-express ^5.0.0
  • tsoa ^6.0.0
  • @types/cors ^2.8.17
  • @types/express ^4.17.21
  • @types/jest ^29.5.11
  • @types/node ^20.10.7
  • @types/passport ^1.0.16
  • @types/passport-http ^0.3.11
  • @types/sanitize-html ^2.9.5
  • @types/supertest ^6.0.2
  • @types/swagger-ui-express ^4.1.6
  • @typescript-eslint/eslint-plugin ^6.18.0
  • @typescript-eslint/parser ^6.18.0
  • eslint ^8.56.0
  • eslint-config-prettier ^9.1.0
  • eslint-plugin-import ^2.29.1
  • jest ^29.7.0
  • nodemon ^3.0.2
  • npm-run-all ^4.1.5
  • openapi-schema-validator ^12.1.3
  • prettier ^3.1.1
  • prisma ^5.7.1
  • supertest ^6.3.3
  • ts-jest ^29.1.1
  • ts-node ^10.9.2
  • typescript ^5.3.3
  • pnpm 8.14.0

  • Check this box to trigger a request for Renovate to run again on this repository

Express, Prisma, PostgreSQL

# TODO: for PostgreSQL introduce.

version: "3"

services:
  db:
    container_name: stock-db
    image: postgres
    volumes:
      - stock-db-data:/var/lib/postgresql/data
    ports:
      - 5555:5432
    environment:
      POSTGRES_USER: ${USERNAME}
      POSTGRES_PASSWORD: ${PASSWORD}
      POSTGRES_DB: stock-db

volumes:
  stock-db-data:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.