
About me:
I’ve worked on things ranging from hardware in omni-directional treadmills and low-level programming to streaming 100’s of thousands of web data with various streaming technologies.
Have programmed in various languages ranging from C to Java, Scala to Clojure, JavaScript and even some languages that are in beta still – a.k.a Unison.
I also love photography, and anything related to cars, design and technology.
The goal:
Get you up and running with a simple, but secure, web API that can accept data from anywhere. Maybe an IoT device, or cell phone, or a web application.
For our case we are going to pretend we are sending some temperature data from an IoT device.
Digital Ocean has free credit for new sign ups, and we can use their cloud to deploy our application with the click of a few buttons.
We will also be storing our data in a relational database called Postgres.
Our API will also allow us to query and retrieve all temperatures from all IoT devices.
Tools:
•Digital Ocean
•Docker
•NodeJS & NPM
•Git & GitHub
•Terminal & Project Scaffolding
•VSCode
•cURL
Install git via the terminal or download from git-scm.com, verify with git --version, and choose an OS-specific method such as Homebrew, Xcode, or the installer.
Open the terminal, create a data-api folder under projects, initialize npm to generate package.json, then in VS Code create index.js and install express to populate node_modules.
Learn to build an express api that handles json data with get and post endpoints for /data, stores data in a data list, and tests with curl using content-type application/json.
Once you have Docker installed, make sure Docker Desktop is running.
Connect your node app to a local postgres database by installing sequelize and pg, configuring a sequelize instance with a database URL, and validating the connection with a test query.
Define a sensor data model to save and query records in a PostgreSQL database, sync the table to the model, and implement create and find all endpoints.
Link your GitHub account to DigitalOcean, choose the data API main branch, and run node index to deploy a dev database and monitor deployment logs.
Deploy and confirm your NodeJS API by deploying to digital oceans cloud, validating build completion, database setup, and a running server that creates and retrieves sensor data via curl.
Verify rate limiting on a deployed NodeJS API by triggering requests to observe 'too many requests' within a sliding minute, and note upcoming API key detection with express middleware.
Push all code to GitHub after testing, create a GitHub Actions workflow to run npm test on Node.js versions 10, 12, 14, and 15, and redeploy the api to DigitalOcean.
Enable cloud build and cloud sql admin APIs, connect github as the repo provider, and create a test cloud sql instance with a postcrisis user for a nodejs api deployment.
Set up a Postgres database and Cloud Run service, copy the Cloud SQL connection name, configure environment variables, and enable public API access for unauthenticated invocation.
The best way to learn is by doing, so get up and running quickly! This course is aimed for beginners with a mission. With various technologies such as Git, Github, NodeJS, Docker, and Digital Ocean's Cloud, we skip some of the mundane coding basics and dive into building a practical application. In this course I will show you how to build a small RESTful API with Node.js and deploy to the cloud within 30 minutes (excluding intro, some setup, and optional videos!). We will be collecting JSON data from IoT 'devices' and storing said data in a cloud hosted relational database called Postgres.
Some technologies used:
Docker
Digital Ocean
Git & GitHub
Node.js and NPM
VSCode
PostgreSQL
cURL
With the application will come some security and testing best practices that you'll be able to extend for more production-ready applications. After the getting started video, you will have a modern programming environment set up that will allow you to continue learning and building applications. There will be a bonus video where we explore extending our Docker setup to be able to deploy our application to any cloud provider, not just Digital Ocean.
Note that we will simulate sending IoT data by just posting random values to our cloud-hosted application.
Note that I'll primarily be developing on a Mac, but will provide hints on installing needed software for Windows.