Simple web API to work on metrics
- Authentication
- CRUD users
- CRUD metrics
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
To build and run this app locally you will need Node.js
Clone the repository
git clone https://github.com/AlexHff/node-metrics.git
cd node-metricsInstall dependencies
npm installPopulate database
npm run populateBuild and run the project
npm run build
npm startFinally, navigate to http://localhost:8081 and you should see the project being served and rendered locally.
This app can also be launched in a Docker container. Go to the directory that has your Dockerfile and run the following command to build the Docker image.
docker build -t node-metrics .Running your image with -d runs the container in detached mode, leaving the container running in the background. The -p flag redirects a public port to a private port inside the container. Run the image you previously built:
docker run -p 8081:8081 -d node-metricsNow open http://localhost:8081 and you should see the app running locally.
Run unit tests
npm testThis application has been deployed to an Elastic Beanstalk environment on AWS.
Use the Elastic Beanstalk CLI (EB CLI) to configure your local repository for deployment to Elastic Beanstalk.
eb init -p docker <application-name>After testing your application locally, deploy it to an Elastic Beanstalk environment. Elastic Beanstalk uses the instructions in your Dockerfile to build and run the image.
Use the EB CLI to create an environment and deploy your application.
eb create <environment-name>Once your environment has launched, use eb open to view it in a web browser.
eb open- Express - Fast, unopinionated, minimalist web framework for Node.js
- EJS - Embedded JavaScript templating
- Level - Fast & simple storage
- Passport - Authentication middleware for Node
- Chart.js - Simple yet flexible JavaScript charting
For more information, see the CONTRIBUTORS file
This project is licensed under the MIT License - see the LICENSE file for details
| Method | Route | Description |
|---|---|---|
| GET | / | Displays the homepage |
| GET | /login | Displays the login form |
| POST | /login | Logs the user in |
| GET | /logout | Signs out the current out |
| GET | /signup | Displays the signup form |
| POST | /signup | Adds a user |
| GET | /user | Gets the current user |
| GET | /metric | Gets all metrics |
| GET | /metric/:id | Gets a metric given an id |
| POST | /new | Adds a new metric |
| POST | /update | Updates an existing metric |
| POST | /delete | Deletes a metric |
- Sergei Kudinov for providing valuable pieces of code related to this project
- startbootstrap-sb-admin-2 for the admin dashboard template