A sample Node.js application that uses the database-js package.

Overview

database-js-starter

A sample Node.js Express API built using the PlanetScale serverless driver for JavaScript. It contains sample API endpoints that can be used to map to various operations on your PlanetScale database:

API Method SQL Action
GET SELECT
POST INSERT
PUT UPDATE
DELETE DELETE

The main goal of this sample is to be used to gain an understanding of how to use the serverless driver in your own code.

For an in-depth explanation of how to use this repo, check the associated article on the PlanetScale docs site.

Set up the database

Before you can start the project, you should set up a database that can be used with the project. Create a database on PlanetScale named travel_db. Once the database has initialized, run the following command to create the necessary structures for the database and insert the sample dataset:

cd scripts
./seed-database.sh

Start the API

To use the project, clone the repository down to your workstation and run the following commands:

npm install
npm start

You should receive a message stating that the API is running.

Test the API

The tests.http file can be used to test the various endpoints. It is designed to be used with the VS Code Rest Client plugin, although it can also be used as a reference in testing with alternate tools.

Further reading

To learn more about the PlanetScale serverless driver for JavaScript, review the following articles:

You might also like...

Sample code for ETH Sign In

Sign in with Ethereum Sample code for ETH Sign In at https://acik-kaynak.org/oauth-guzel-peki-ethereumu-denediniz-mi/ The related code for Sign in wit

Jan 2, 2023

Sample of CI/CD auto deploy to own server via Github Actions

Psst — looking for a more complete solution? Check out SvelteKit, the official framework for building web applications of all sizes, with a beautiful

Mar 19, 2022

Sample code of UI projects for SAP BTP Launchpad Service.

SAP BTP Launchpad Service Samples This repository contains the sample projects which are discussed in blog Designing UI5 Apps for SAP Launchpad Servic

Dec 15, 2022

NestJS + AWS SQS sample

nestjs-sqs-sample 概要 NestJS + AWS SQSのサンプルプロジェクトです。 localstackのSQSを使用して動作確認をします。 動作環境 Mac OS Node.js - 16.x yarn - 1.22.x Docker Desktop - 4.2.0以上 AWS

Oct 18, 2022

JavaScript Express.js app serving static vanilla JS. This sample app is used in Microsoft Docs to demonstrate how to integrate Azure Storage, Azure Cosmos DB, and Azure Active Directory.

JavaScript on Azure Learn Path - Module 2 - Deploying a basic app to Azure This Learn module requires the following Azure resources to deploy correctl

Dec 31, 2022

Utility for authorizing user in a connected app, creating JWT to authenticate against it, and perform a sample callout.

Question: What is this for? Answer: When configuring a Salesforce Connected app to use certificates to authenticate you will use JSON Web Tokens to a

Jun 15, 2022

A sample CICD Deployment Pipeline for your Alexa Skills, using AWS CDK, CodeBuild and CodePipeline

A sample CICD Deployment Pipeline for your Alexa Skills, using AWS CDK, CodeBuild and CodePipeline

Alexa Skils - CI/CD CDK Pipeline This repository will help you setting up a CI/CD pipeline for your Alexa Skills. This pipeline is powered by AWS Clou

Nov 23, 2022

Textme.lk SMS SDK and Sample Apps

TextME Javascript SDK Table of Content Introduction Prerequisite Install Getting Started APIs constructor sendSMS viewSMS viewAllSMS Models ClientConf

Jan 29, 2022

Serverless Framework + typescript + mongoDB atlas, sample

sls_ts6 Version: 0.9.1 Author : Kouji Nakashima / kuc-arc-f.com date : 2022/01/21 update : Summary Serverless Framework + typescript + mongoDB atlas,

Jan 22, 2022
Comments
  • fetch is note a function

    fetch is note a function

    *not at postJSON (node_modules/@planetscale/database/dist/index.js:80:28) at Connection.execute (node_modules/@planetscale/database/dist/index.js:48:29)

    opened by ash-hashtag 0
Owner
PlanetScale
The database for developers.
PlanetScale
Package fetcher is a bot messenger which gather npm packages by uploading either a json file (package.json) or a picture representing package.json. To continue...

package-fetcher Ce projet contient un boilerplate pour un bot messenger et l'executable Windows ngrok qui va permettre de créer un tunnel https pour c

AILI Fida Aliotti Christino 2 Mar 29, 2022
Short sample and instructions for configuring a Flutter Web application to deploy-on-push to Firebase Hosting

Short sample and instructions for configuring a Flutter Web application to deploy-on-push to Firebase Hosting

Kevin Moore 18 Nov 17, 2022
Multi-platform node package bundle to a package.json.

dmpc Multi-platform node package bundle to a package.json. install ### npm mode npm i -g @kingsword/dmpc ### yarn mode yarn global add @kingsword/dmp

Kingsword 2 Oct 16, 2022
Script to synchronize between a Notion database and Google Calendar both ways. Uses Google App Script.

Yet Another Two Way Notion-Google Calendar Sync Script A script to sync events between Google calendar and a Notion database. Features! Google App Scr

kat 41 Jan 7, 2023
A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YAML support designed to be easy to set up and use

About A high-resolution local database that uses precise algorithms to easily record data in local files within a project with persistent JSON and YML

Shuruhatik 5 Dec 28, 2022
Interplanetary Database: A Database built on top of IPFS and made immutable using Ethereum blockchain.

IPDB IPDB (Interplanetary Database) is a key/value store database built on top of IPFS (Interplanetary File System). Project is intended to be an MVP

turinglabs 8 Oct 6, 2022
Visualize, modify, and build your database with dbSpy! An open-source data modeling tool to facilitate relational database development.

Visualize, modify, and build your database with dbSpy! dbSpy is an open-source data modeling tool to facilitate relational database development. Key F

OSLabs 115 Dec 22, 2022
Blog application api in Node.js express.js sequelize ORM and MYSQL Database

Node Express Mysql Sequelise Blog System Api Node api with express mysql sequelise Usage To get started with this api follow the steps below $ git clo

Kaddu Livingstone 6 Nov 9, 2022
A package to manage cron-jobs in a node.js Typescript application.

This package is a package to manage cron-jobs in a node.js Typescript application. It is built using node-cron and reflect-metadata packages

Osemudiamen Itua 7 Jul 17, 2022
This package is for developers to be able to easily integrate bad word checking into their projects.\r This package can return bad words in array or regular expression (regex) form.

Vietnamese Bad Words This package is for developers to be able to easily integrate bad word checking into their projects. This package can return bad

Nguyễn Quang Sáng 8 Nov 3, 2022