This repository contains the Node/Express webserver and DynamoDB API routes/controllers for the pennant-notebook project.
Ensure you have a .env file set up in your project root. You can use the .env.example file in the repository as a template. Copy it and rename to .env, then fill in the necessary environment variables.
- Clone the repository:
git clone https://github.com/pennant-notebook/server.git- Navigate to the project directory:
cd server- Install the necessary npm packages:
npm installFor development purposes, you can run the server using the following command which will enable hot-reloading:
npm run devBefore deploying the server in a production environment, build the project using the following command:
npm run buildAfter building the project, start the server using:
npm startThis will start the server using the built files in the dist directory.
| Field | Type |
|---|---|
username |
string |
hashedPassword |
string |
provider |
string |
userID |
UUID string |
- Partition key:
username - Provider options:
google,github,username, ornull(used only in auth flow – seeauth.jsfor more details)
| Field | Type |
|---|---|
username |
string |
title |
string |
docID |
UUID string |
- Partition key:
docID(String) - Sort key:
username(String)
- Endpoint:
GET /api/user/:username - Description: Fetches a user from the
notebookuserstable.
- Endpoint:
POST /api/user/:username - Description: Creates a new user in the
notebookuserstable.
- Endpoint:
GET /api/user/:username/notebooks - Description: Fetches all notebooks for a given user from the
notebookstable.
- Endpoint:
GET /api/doc/:docID/:username - Description: Fetches a notebook with a given
docIDandusernamefrom thenotebookstable.
- Endpoint:
POST /api/doc/:username - Description: Creates a new notebook for a given
usernamein thenotebookstable.
- Endpoint:
PUT /api/doc/:docID/:username - Description: Edits the title for a notebook for a given
docIDin thenotebookstable. - Request Body: Expects a JSON object containing the new title as a
titleproperty (e.g.,{ "title": "New Title Here" }).