GitHub - navjit72/node-app

Buildings API

About

This is a basic CRUD application that reads and writes information about Buildings, and Thermostats to a sql database.

We are using an in-memory sqlite instance, which is seeded on application start. Restarting the application will reseed the database.

Tools

Node (version), sqlite, sqlite3

Set up

Might into install the dependencies: ie. npm install express

Commands

  • npm run start: Starts the application

If the server runs successfully, you should see the following message: Server running at http://localhost:3000

Sample API Calls

List Buildings

curl -X GET http://localhost:3000/buildings

Create a Building

curl -X POST http://localhost:3000/buildings --json '{
  "name": "Building 1",
  "address": "123 Main St"
}'

Delete a Building By ID

curl -X DELETE http://localhost:3000/buildings/1