Skip to content

Node.js example backend for kPaste

License

Notifications You must be signed in to change notification settings

Maxime-J/kpaste-example-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js example backend for kPaste,
exposing the REST API used in NewPaste and ShowPaste components
+ a web accessible cron task for expirated pastes deletion.

It follows what kPaste sends and expects, so it just works by setting the provided endpoints, which are :
POST /api/paste
GET /api/paste/{id}

Expirated pastes aren't accessible, but obviously still in database,
/cron route deletes them.

Important notes:

- This is not used or provided by Infomaniak.
- kPaste isn't meant to be a distribuable project, it contains Infomaniak specific code and assets.
- Fonts used by kPaste probably can't be freely reused in terms of licensing.
- CORS is handled, Access-Control-Allow-Origin being set to the request origin because kPaste use of fetch (with credentials) prevents wildcard use.
- While kPaste service is XSRF protected, this isn't.
- This is an example, not quite intented to be used as is. That also means eventual changes are made without caring of any migration need.

Usage

DATABASE_URL environnement variable must be set in .env file at project root,
leading to a MySQL database (see Prisma docs).

Table should be created after dependencies installation by running:

npx prisma db push

(which also generates the database client).

About

Node.js example backend for kPaste

Resources

License

Stars

Watchers

Forks