https://github.com/msftserver/print2a.com-api
api for print2a.com
https://github.com/msftserver/print2a.com-api
Last synced: about 1 month ago
JSON representation
api for print2a.com
- Host: GitHub
- URL: https://github.com/msftserver/print2a.com-api
- Owner: MSFTserver
- Created: 2021-01-28T06:01:20.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T01:24:03.000Z (over 2 years ago)
- Last Synced: 2025-03-02T09:17:38.970Z (over 1 year ago)
- Language: CSS
- Size: 240 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README

# Print2a Filesystem API
## Overview
This is a REST API and Displays directories on the fileystem.
## Quickstart
`npm install && npm run start`
### Implementation
This is a ECMAScript 2015+ implementation using node 12+ with the relatively [recent Node support ESM `import` syntax](https://nodejs.org/api/esm.html).
We use a classic Express routing pattern with query string parameters and typical REST HTTP verbs.
There is no database; persistence is managed with the filesystem using async Node `fs` operations.
## Docker management
We use docker to package the container, with a minimalist [Dockerfile](Dockerfile).
- Build: `docker build -t / .`
- Run: `docker run -p 49160:8080 -d /`
- View processes: `docker ps`
- Cleanup containers: `docker kill $(docker ps -q)`
### Local development
Install dependencies: `npm install`
Run with livereloading using nodemon: `npm start` which uses [nodemon](https://www.npmjs.com/package/nodemon) for livereloading.
Management scripts are defined in [package.json](package.json).
### Testing
The [test suite](test/app.test.js) is managed with Mocha using a BDD sytax.
The existing tests are a good representation of feature coverage provided by the API.
### Swagger API documentation
Each API endpoint is fully documented with inline JSDoc comments (in [src/server.js]) and a we use [Swagger UI Express](https://www.npmjs.com/package/swagger-ui-express) to build a Swagger spec and render a [Swagger UI](http://0.0.0.0:8080/api-docs/) at `/api-docs`.