Skip to content

Files

Latest commit

 

History

History
95 lines (65 loc) · 1.93 KB

README.md

File metadata and controls

95 lines (65 loc) · 1.93 KB

JW Notes Merger Server

Simple server using Express and Node.js for merging JW Library's notes, bookmarks and markup.

Pre-requisites

  • Install Node.js version 15 or higher

Getting started

  • Clone the repository
git clone https://github.com/LeomaiaJr/JW-Notes-Merger-Server
  • Install dependencies
cd JW-Notes-Merger-Server
npm install
  • Define environment variables, following the .env.example file
API_PORT=8080
  • Run the server in development mode with watch mode
npm run dev
  • Build the server for production
npm run build

Containerization

  • Build the container
docker build -t jw-notes-merger-server .
  • Run the container
docker run -d -it --rm --name jw-notes-merger-server -p 8080:8080 jw-notes-merger-server:latest

To run it with logging, leave the -d out of the above command, or run the following after the above:

docker logs -f jw-notes-merger-server

Use ctrl+c to exit.

To stop and remove the container, run the following:

docker stop jw-notes-merger-server && docker rm -f jw-notes-merger-server

Endpoints

  • /merge-db
    • POST
    • Merge 2 notes files into 1
    • Accepts 2 notes files with .jwlibrary extension
    • Returns a File with the following properties:
      • name: merged
      • extension: .jwlibrary
    • Example error:
      • 400 Bad Request
        • { "message": "Two valid files are required" }
        • { "message": "Only .jwlibrary files are allowed" }
      • 500 Internal Server Error
        • { "message": "Unexpected error" }

Production Environment