Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drewcook/beerbuddy-api
The REST API services for BeerBuddy applications, built in Node.
https://github.com/drewcook/beerbuddy-api
express mongo mongodb nodejs
Last synced: 5 days ago
JSON representation
The REST API services for BeerBuddy applications, built in Node.
- Host: GitHub
- URL: https://github.com/drewcook/beerbuddy-api
- Owner: drewcook
- Created: 2021-03-26T17:35:10.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-04T07:11:14.000Z (almost 3 years ago)
- Last Synced: 2024-04-10T10:01:10.908Z (9 months ago)
- Topics: express, mongo, mongodb, nodejs
- Language: JavaScript
- Homepage: https://api.beerbuddy.io
- Size: 837 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BeerBuddy API
This repository is an API built with Node.js and Express.js. There are full RESTful endpoints setup, authentication, authorization, error handling, and logging.
## Prerequisites
To run this service, you must have a local instance of both Node and MongoDB installed on your machine.- [Install Node](https://nodejs.org)
- [Install MongoDB](https://docs.mongodb.com/manual/administration/install-community/)## Installing packages
You can use NPM to install the package dependencies for the application. Run the following command:
```bash
npm install
```
## Running the Service Locally
Since generating a JWT relies on a secret to sign and verify against, export a variable that the app will understand to use for this secret key. The name of the variable should be `BEERBUDDY_APP_SECRET`. First run the following:
```bash
export BEERBUDDY_APP_SECRET=12345
```
Then, to start the application, run the following command:
```bash
npm start
```
This will spin up the server on `localhost:5280` attempt to make a connection to your local MongoDB instance.### Logs
Local log files are created which will store any logs for development. They are as follows:
- `error.log`: Contains all logs with level `error` and below
- `combined.log`: Contains all logs with level `info` and below
- `exceptions.log`: Contains all unhandled exception logs
- `rejections.log`: Contains all unhandled rejection logs (not working currently)Additionally, there is plumbing set up to log errors into a MongoDB table of `[appname]_logs`. Currently it is commented out.
## Using the Production Service
The service is deployed to a Heroku environment, and the data is being stored in a MongoDB Atlas Cloud database. The current production service can be accessed [here](https://api.beerbuddy.com/).