David-Inkheart / express-js-crash-course

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

express-js-crash-course

This is a basic CRUD application using ExpressJS. RESTful API is used to perform CRUD operations on a book collection. Handlebars is used as the view engine.

A mix of both MVC and RESTful API architecture is used in this project. The MVC architecture is used to render the views and the RESTful API architecture is used to perform CRUD operations on the book collection. While apps like this are usually built using one architecture, I wanted to try out a mix of both architectures, so this serves as a template, a good reference and learning experience for me.

Quick Start

# Install dependencies
npm install

# Serve on localhost:5000
npm run dev

Endpoints

Get All Books

GET /api/books

Get Single Book

GET /api/books/:id

Delete Book

DELETE /api/books/:id

Add Book

POST /api/books
# Request sample
{
  "title": "Book Title",
  "author": "Book Author",
  "genre": "Book Genre"
}

Update Book

PUT /api/books/:id
# Request sample
{
  "title": "Updated Title",
  "author": "Updated Author",
  "genre": "Updated Genre"
}

About


Languages

Language:JavaScript 63.7%Language:Handlebars 25.2%Language:HTML 10.3%Language:CSS 0.8%