Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 504 Bytes

File metadata and controls

29 lines (18 loc) · 504 Bytes

CSRF middleware example

Simple tinyhttp app using Malibu as the CSRF middleware

Setup

Install dependencies

tinyhttp new malibu

Run

node index.js

Endpoints

GET / will return CSRF token in form of { "token": "csrf token" }

POST / will do everything else, but it's protected with CSRF token.

Example request:

curl --header 'csrf-token: csrf_token_from_get_request' --request POST http://localhost:3000/