Skip to content

upleveled/express-guest-list-api-memory-data-store

Repository files navigation

Express REST Guest List API

A simple, naïve, in-memory RESTful guest list API in Express.

Installation

git clone https://github.com/upleveled/express-guest-list-api-memory-data-store.git
cd express-guest-list-api-memory-data-store
pnpm install
pnpm start

Usage

Base URL

const baseUrl = 'http://localhost:4000';

Getting all guests (aka GET /guests)

const response = await fetch(`${baseUrl}/guests`);
const allGuests = await response.json();

Getting a single guest (aka GET /guests/:id)

const response = await fetch(`${baseUrl}/guests/:id`);
const guest = await response.json();

Creating a new guest (aka POST /guests)

const response = await fetch(`${baseUrl}/guests`, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ firstName: 'Karl', lastName: 'Horky' }),
});
const createdGuest = await response.json();

Updating a guest (aka PUT /guests/:id)

const response = await fetch(`${baseUrl}/guests/1`, {
  method: 'PUT',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ attending: true }),
});
const updatedGuest = await response.json();

Deleting a guest (aka DELETE /guests/:id)

const response = await fetch(`${baseUrl}/guests/1`, { method: 'DELETE' });
const deletedGuest = await response.json();

Deploy on Deno Deploy

  1. Click "Fork" at the top right of the express-guest-list-api-memory-data-store GitHub repository page, select your GitHub account and click "Fork" to create a copy of the GitHub repository in your account
  2. On Deno Deploy - New App, click on "Sign in with GitHub", authorize Deno Deploy to access your GitHub account and accept the terms and conditions
  3. If your account doesn't appear in the "Select user or organization" dropdown, select "Add another GitHub Account", and then on the install page on GitHub, select your GitHub account, choose "Only select repositories", select the repository express-guest-list-api-memory-data-store from the dropdown and click the green "Install" button
  4. Select your GitHub account in the dropdown and select the forked repository express-guest-list-api-memory-data-store
  5. Scroll to the bottom of the page and click "Create App"
  6. After all stages of the build are marked with green checkmarks, click "Overview" on the left to continue to the project overview page

The API URL is on the top right of the project overview page under "Production URL".

Related

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors