This project is used to generate images to be used in mocks
https://imaginer.ksonit.lt/100/100?scale=2&background=rgb(150,200,255)
npm install
If the scaling behaves poorly, need to compile from source with npm install canvas --build-from-source
: Automattic/node-canvas#1506
Start server with npm run dev
. Open http://localhost:4321/100/100?scale=2&background=rgb(150,200,255)
tsc
Compiles the app in preparation of production launchdev
Startsts-node-dev
, which compiles typescript without generating files, reloads on changes and launchesindex.ts
(which is anexpress
server in this case)prod
Compiles the app and launches it (fromdist/index.js
)
canvas
Crux of the app: this is used to draw images using HTML Canvas APIexpress
Backend server to easily get access to request information (path, query), have different routes, etc.typescript
Have typests-node-dev
Since this is a node server and not source code for web app, we don't use a bundler. Therefore we need to compile typescript before runningindex.ts
on our own. On production this will happen withnpm run tsc
, but while developing it is more convenient to have it auto recompile when files have changed