Skip to content

afyqzarof/studio-server

Repository files navigation

studio server

Back End GitHub Repository

Links:

Tech Stack

node.js express.js react sqlite

APIs

To run

  1. Ensure .env file is filled in according to .env.sample
  2. Create /database directory and add file dev.sqlite3 to it
  3. Install dependencies:
npm install
  1. Run migrations:
npm run migrate
  1. Seed data:
npm run seed
  1. Start development server:
npm run dev

Details

HR Diagram

image

Endpoints (Not an exhaustive list)

GET /api/users/:user-id

  • Fetch use details for a given user
  • Example Response:
{
  "id": 1,
  "username": "nuclear.instruments",
  "email": "user@example.com"
}

GET /api/users/:user-id/boards

  • Fetch board details for a specific user
  • Example response:
[
  {
    "id": 1,
    "board_name": "My First Board",
    "is_public": false
  },
  {
    "id": 2,
    "board_name": "Example Board",
    "is_public": false
  },
  {
    "id": 3,
    "board_name": "music video inspo",
    "is_public": true
  }
]

GET /api/boards/:board-id/pins

  • Fetch pins for a specific board
  • Example response:
[
  {
    "id": "xFLA-XMirt",
    "type": "YoutubeVidNode",
    "data": { "youtube_id": "sDENI1Zx7Wc" },
    "position": { "x": 300, "y": 200 }
  },
  {
    "id": "mB_6kTKt3Y",
    "type": "TextNode",
    "data": { "text": "this is a text box" },
    "position": { "x": 250, "y": 100 }
  },
  {
    "id": "WVQoDv6ewX",
    "type": "ColorSelectorNode",
    "data": { "color": "#4c4cff" },
    "position": { "x": 0, "y": 0 }
  }
]

PUT /api/boards/:board-id/pins

  • Update pins on a specific board when a user saves

post /api/users

  • Initialize a new user upon registration

post /api/users/:user-id/boards

  • Initialize a new board for a given user upon creation

get /api/boards/public

  • get all boards that are set to "public"

About

An Express server and mySQL database for studio

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors