https://github.com/do-community/node-express-api
https://github.com/do-community/node-express-api
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/do-community/node-express-api
- Owner: do-community
- Created: 2021-04-22T17:28:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-28T21:49:23.000Z (over 2 years ago)
- Last Synced: 2025-03-28T00:44:07.454Z (about 1 year ago)
- Language: JavaScript
- Size: 3.33 MB
- Stars: 4
- Watchers: 0
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node Fastify API
This is a demo application for building a Node API. In this demo, we will do CRUD operations on Tweets.
Node APIs and MongoDB go hand-in-hand. This demo app uses:
- [Node.js]
- [Express](https://expressjs.com/) - Fast and low overhead web framework
- [MongoDB](https://www.mongodb.com/) on [DigitalOcean](https://www.digitalocean.com/products/managed-databases/)
- [MongoDB NodeJS Driver](https://www.npmjs.com/package/mongodb) - Connect Node to MongoDB
## Routes
The routes for this app are:
- `GET /tweets`: Get all tweets
- `POST /tweets`: Create a tweet
- `GET /tweets/`: Get a single tweet
- `PUT /tweets/`: Update a tweet
- `DELETE /tweets/`: Delete a tweet
## Deploying to DigitalOcean
[](https://cloud.digitalocean.com/apps/new?repo=https://github.com/do-community/node-express-api/tree/master)
## How to Deploy
This demo can be deployed using the 1-click button above. If you want to deploy this to your [DigitalOcean App Platform](https://www.digitalocean.com/products/app-platform/), follow these steps:
1. Fork this repo so you have this on your GitHub account
1. Create a MongoDB Database
1. Login to your [DigitalOcean App Platform Dashboard](https://cloud.digitalocean.com/apps)
1. Click `Create App`
1. Search for your GitHub repo
1. Remove the `npm run build` command from the build setup
1. Link the MongoDB database you just created
1. Follow the steps to deploy
1. Add your MongoDB DATABASE_URL to your environment variables
1. Add your MongoDB CA_CERT to your environment variables
## Adding a MongoDB Database
1. Login to your [DigitalOcean](https://www.digitalocean.com) account
1. Go to `Create` -> `Database`
1. Create a MongoDB Database
1. Grab the connection URL
1. Add an environment variable in App Platform called `DATABASE_URL`