CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/express-security-basics

Security defaults that belong in every Express application from day one.

93

6.18x
Quality

90%

Does it follow best practices?

Impact

99%

6.18x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

task.mdevals/scenario-2/

Build an E-Commerce Order API

Problem/Feature Description

An e-commerce company needs a REST API for their order management system. The API is built with Express and TypeScript. A Vue.js storefront on a separate domain will call this API. The service runs behind a single nginx proxy in their data center.

The API needs the following endpoints:

  • GET /api/products -- list all products
  • GET /api/products/:id -- get a single product
  • POST /api/orders -- place a new order (accepts items array with productId and quantity, plus customerEmail)
  • GET /api/orders/:id -- get order details
  • GET /api/orders -- list orders (supports ?status=pending filter)

Use in-memory arrays for products and orders. Products should have id, name, price, and stock fields. Orders should have id, items, customerEmail, total, status, and createdAt. When an order is placed, validate that products exist and have sufficient stock, then decrement stock accordingly.

Output Specification

Produce:

  • app.ts -- Express application with all middleware and route setup
  • routes/products.ts -- Router module for product endpoints
  • routes/orders.ts -- Router module for order endpoints
  • package.json -- With all required dependencies

evals

tile.json