A simple API builded to manage the user to resize the images based on URL parameters values.
- [TypeScript] (https://www.typescriptlang.org/docs/)
- [Node.JS] (https://nodejs.org/dist/latest-v16.x/docs/api/)
- [Express] (https://expressjs.com/)
- [fs-extra] (https://www.npmjs.com/package/fs-extra)
- [Sharp] (https://www.npmjs.com/package/sharp)
- [Prettier] (https://prettier.io/docs/en/index.html)
- [ESLint] (https://eslint.org/docs/user-guide/getting-started)
- [Jasmine] (https://jasmine.github.io/)
- [supertest] (https://www.npmjs.com/package/supertest)
Some Description of the folders:
assets
: Images to be processed by the APIspec
: Jasmine Configurationcontrollers
: API Handlersroutes
: API Routers
+---assets
| \---images
| \---src
+---spec
| \---support
\---src
| index.ts
|
+---controllers
+---routes
| \---images
|
+---tests
-
Install all dependencies
npm i
-
Build the project from TypeScript to JavaScript
npm run build
-
Start the Server
npm start
The server will start on port: the user environment port, or the default host is on: http://localhost:3000.
-
Run the Tests
npm run test
-
Run Prettier and ESLint
npm run prettier
npm run lint
PATH: /api/images/:imageName
Method: GET
Parameter | Required |
---|---|
width | Yes |
height | No (default height = width) |
ext | No (default jpg) |
Example:
/api/images/fjord&width=200&height=300
dev
:nodemon ./src/index.t
test
:tsc && jasmine
build
:npm run clean && tsc
start
:npm run build && nodemon build/index.js
format:src
:prettier --write src/**/*.ts
eslint
:eslint . --ext .ts
clean
:rimraf ./build
clean:thumbs
:rimraf ./assets/images/build
jasmine
:jasmine