fix: remove user stories (#42)
* fix: remove user stories * fix: remove assets + add sample.env, dotenv, gitignore * fix: update package-lock * fix: add dotenv + update package-lock * feat: remove error handling * fix: remove mlab env var * fix: remove bashrc * remove express body parser + organize code * fix: remove gitconfig
This commit is contained in:
		
							parent
							
								
									bc38f78803
								
							
						
					
					
						commit
						e3a0289ea2
					
				
					 11 changed files with 14 additions and 401 deletions
				
			
		
							
								
								
									
										114
									
								
								.bashrc
									
										
									
									
									
								
							
							
						
						
									
										114
									
								
								.bashrc
									
										
									
									
									
								
							|  | @ -1,114 +0,0 @@ | ||||||
| # ~/.bashrc: executed by bash(1) for non-login shells. |  | ||||||
| # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) |  | ||||||
| # for examples |  | ||||||
| 
 |  | ||||||
| # If not running interactively, don't do anything |  | ||||||
| case $- in |  | ||||||
|     *i*) ;; |  | ||||||
|       *) return;; |  | ||||||
| esac |  | ||||||
| 
 |  | ||||||
| # don't put duplicate lines or lines starting with space in the history. |  | ||||||
| # See bash(1) for more options |  | ||||||
| HISTCONTROL=ignoreboth |  | ||||||
| 
 |  | ||||||
| # append to the history file, don't overwrite it |  | ||||||
| shopt -s histappend |  | ||||||
| 
 |  | ||||||
| # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) |  | ||||||
| HISTSIZE=1000 |  | ||||||
| HISTFILESIZE=2000 |  | ||||||
| 
 |  | ||||||
| # check the window size after each command and, if necessary, |  | ||||||
| # update the values of LINES and COLUMNS. |  | ||||||
| shopt -s checkwinsize |  | ||||||
| 
 |  | ||||||
| # If set, the pattern "**" used in a pathname expansion context will |  | ||||||
| # match all files and zero or more directories and subdirectories. |  | ||||||
| #shopt -s globstar |  | ||||||
| 
 |  | ||||||
| # make less more friendly for non-text input files, see lesspipe(1) |  | ||||||
| [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" |  | ||||||
| 
 |  | ||||||
| # set variable identifying the chroot you work in (used in the prompt below) |  | ||||||
| if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then |  | ||||||
|     debian_chroot=$(cat /etc/debian_chroot) |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| # set a fancy prompt (non-color, unless we know we "want" color) |  | ||||||
| case "$TERM" in |  | ||||||
|     xterm-color|*-256color) color_prompt=yes;; |  | ||||||
| esac |  | ||||||
| 
 |  | ||||||
| # uncomment for a colored prompt, if the terminal has the capability; turned |  | ||||||
| # off by default to not distract the user: the focus in a terminal window |  | ||||||
| # should be on the output of commands, not on the prompt |  | ||||||
| #force_color_prompt=yes |  | ||||||
| 
 |  | ||||||
| if [ -n "$force_color_prompt" ]; then |  | ||||||
|     if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then |  | ||||||
|         # We have color support; assume it's compliant with Ecma-48 |  | ||||||
|         # (ISO/IEC-6429). (Lack of such support is extremely rare, and such |  | ||||||
|         # a case would tend to support setf rather than setaf.) |  | ||||||
|         color_prompt=yes |  | ||||||
|     else |  | ||||||
|         color_prompt= |  | ||||||
|     fi |  | ||||||
| fi |  | ||||||
| if [ "$color_prompt" = yes ]; then |  | ||||||
|     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@${PROJECT_NAME}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' |  | ||||||
| else |  | ||||||
|     PS1='${debian_chroot:+($debian_chroot)}\u@${PROJECT_NAME}:\w\$ ' |  | ||||||
| fi |  | ||||||
| unset color_prompt force_color_prompt |  | ||||||
| # If this is an xterm set the title to user@host:dir |  | ||||||
| case "$TERM" in |  | ||||||
| xterm*|rxvt*) |  | ||||||
|     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" |  | ||||||
|     ;; |  | ||||||
| *) |  | ||||||
|     ;; |  | ||||||
| esac |  | ||||||
| # enable color support of ls and also add handy aliases |  | ||||||
| if [ -x /usr/bin/dircolors ]; then |  | ||||||
|     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" |  | ||||||
|     alias ls='ls --color=auto' |  | ||||||
|     #alias dir='dir --color=auto' |  | ||||||
|     #alias vdir='vdir --color=auto' |  | ||||||
|     alias grep='grep --color=auto' |  | ||||||
|     alias fgrep='fgrep --color=auto' |  | ||||||
|     alias egrep='egrep --color=auto' |  | ||||||
| fi |  | ||||||
| # colored GCC warnings and errors |  | ||||||
| #export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' |  | ||||||
| # some more ls aliases |  | ||||||
| alias ll='ls -alF' |  | ||||||
| alias la='ls -A' |  | ||||||
| alias l='ls -CF' |  | ||||||
| # Add an "alert" alias for long running commands.  Use like so: |  | ||||||
| #   sleep 10; alert |  | ||||||
| alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s |  | ||||||
| /[;&|]\s*alert$//'\'')"' |  | ||||||
| # Alias definitions. |  | ||||||
| # You may want to put all your additions into a separate file like |  | ||||||
| # ~/.bash_aliases, instead of adding them here directly. |  | ||||||
| # See /usr/share/doc/bash-doc/examples in the bash-doc package. |  | ||||||
| if [ -f ~/.bash_aliases ]; then |  | ||||||
|     . ~/.bash_aliases |  | ||||||
| fi |  | ||||||
| # enable programmable completion features (you don't need to enable |  | ||||||
| # this, if it's already enabled in /etc/bash.bashrc and /etc/profile |  | ||||||
| # sources /etc/bash.bashrc). |  | ||||||
| if ! shopt -oq posix; then |  | ||||||
|   if [ -f /usr/share/bash-completion/bash_completion ]; then |  | ||||||
|     . /usr/share/bash-completion/bash_completion |  | ||||||
|   elif [ -f /etc/bash_completion ]; then |  | ||||||
|     . /etc/bash_completion |  | ||||||
|   fi |  | ||||||
| fi |  | ||||||
| 
 |  | ||||||
| export NVM_DIR="/home/nvm/.nvm" |  | ||||||
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm |  | ||||||
| 
 |  | ||||||
| # set PATH so it includes user's private bin directories |  | ||||||
| export PATH="$HOME/bin:$HOME/.local/bin:$HOME/node_modules/.bin:$PATH" |  | ||||||
|  | @ -1,2 +0,0 @@ | ||||||
| [core] |  | ||||||
| 	excludesfile = /etc/.gitignore-global |  | ||||||
							
								
								
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | .env | ||||||
|  | node_modules | ||||||
|  | @ -1,3 +0,0 @@ | ||||||
| {"name":"drag-in-files.svg","date":"2016-10-22T16:17:49.954Z","url":"https://cdn.hyperdev.com/drag-in-files.svg","type":"image/svg","size":7646,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/drag-in-files.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(102, 153, 205)","uuid":"adSBq97hhhpFNUna"} |  | ||||||
| {"name":"click-me.svg","date":"2016-10-23T16:17:49.954Z","url":"https://cdn.hyperdev.com/click-me.svg","type":"image/svg","size":7116,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/click-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(243, 185, 186)","uuid":"adSBq97hhhpFNUnb"} |  | ||||||
| {"name":"paste-me.svg","date":"2016-10-24T16:17:49.954Z","url":"https://cdn.hyperdev.com/paste-me.svg","type":"image/svg","size":7242,"imageWidth":276,"imageHeight":276,"thumbnail":"https://cdn.hyperdev.com/paste-me.svg","thumbnailWidth":276,"thumbnailHeight":276,"dominantColor":"rgb(42, 179, 185)","uuid":"adSBq97hhhpFNUnc"} |  | ||||||
							
								
								
									
										14
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								README.md
									
										
									
									
									
								
							|  | @ -1,13 +1 @@ | ||||||
| # Exercise Tracker REST API | # [Exercise Tracker](https://www.freecodecamp.org/learn/apis-and-microservices/apis-and-microservices-projects/exercise-tracker) | ||||||
| 
 |  | ||||||
| #### A microservice project, part of Free Code Camp's curriculum |  | ||||||
| 
 |  | ||||||
| ### User Stories |  | ||||||
| 
 |  | ||||||
| [](https://repl.it/github/freeCodeCamp/boilerplate-project-exercisetracker) |  | ||||||
| 
 |  | ||||||
| 1. I can create a user by posting form data username to /api/exercise/new-user and returned will be an object with username and _id. |  | ||||||
| 2. I can get an array of all users by getting api/exercise/users with the same info as when creating a user. |  | ||||||
| 3. I can add an exercise to any user by posting form data userId(_id), description, duration, and optionally date to /api/exercise/add. If no date supplied it will use current date. Returned will be the user object with also with the exercise fields added. |  | ||||||
| 4. I can retrieve a full exercise log of any user by getting /api/exercise/log with a parameter of userId(_id). Return will be the user object with added array log and count (total exercise count). |  | ||||||
| 5. I can retrieve part of the log of any user by also passing along optional parameters of from & to or limit. (Date format yyyy-mm-dd, limit = int) |  | ||||||
|  |  | ||||||
							
								
								
									
										230
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										230
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							|  | @ -18,19 +18,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", | 			"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", | ||||||
| 			"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" | 			"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" | ||||||
| 		}, | 		}, | ||||||
| 		"async": { |  | ||||||
| 			"version": "2.6.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/async/-/async-2.6.0.tgz", |  | ||||||
| 			"integrity": "sha512-xAfGg1/NTLBBKlHFmnd7PlmUW9KhVQIUuSrYem9xzFUZy13ScvtyGGejaae9iAVRiRq9+Cx7DPFaAAhCpyxyPw==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"lodash": "^4.14.0" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"bluebird": { |  | ||||||
| 			"version": "3.5.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz", |  | ||||||
| 			"integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw=" |  | ||||||
| 		}, |  | ||||||
| 		"body-parser": { | 		"body-parser": { | ||||||
| 			"version": "1.19.0", | 			"version": "1.19.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", | 			"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", | ||||||
|  | @ -48,16 +35,6 @@ | ||||||
| 				"type-is": "~1.6.17" | 				"type-is": "~1.6.17" | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"bson": { |  | ||||||
| 			"version": "1.0.9", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/bson/-/bson-1.0.9.tgz", |  | ||||||
| 			"integrity": "sha512-IQX9/h7WdMBIW/q/++tGd+emQr0XMdeZ6icnT/74Xk9fnabWn+gZgpE+9V+gujL3hhJOoNrnDVY7tWdzc7NUTg==" |  | ||||||
| 		}, |  | ||||||
| 		"buffer-shims": { |  | ||||||
| 			"version": "1.0.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", |  | ||||||
| 			"integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=" |  | ||||||
| 		}, |  | ||||||
| 		"bytes": { | 		"bytes": { | ||||||
| 			"version": "3.1.0", | 			"version": "3.1.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", | 			"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", | ||||||
|  | @ -86,11 +63,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", | 			"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", | ||||||
| 			"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" | 			"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" | ||||||
| 		}, | 		}, | ||||||
| 		"core-util-is": { |  | ||||||
| 			"version": "1.0.2", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", |  | ||||||
| 			"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" |  | ||||||
| 		}, |  | ||||||
| 		"cors": { | 		"cors": { | ||||||
| 			"version": "2.8.5", | 			"version": "2.8.5", | ||||||
| 			"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", | 			"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", | ||||||
|  | @ -118,6 +90,11 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", | 			"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", | ||||||
| 			"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" | 			"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" | ||||||
| 		}, | 		}, | ||||||
|  | 		"dotenv": { | ||||||
|  | 			"version": "8.2.0", | ||||||
|  | 			"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-8.2.0.tgz", | ||||||
|  | 			"integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==" | ||||||
|  | 		}, | ||||||
| 		"ee-first": { | 		"ee-first": { | ||||||
| 			"version": "1.1.1", | 			"version": "1.1.1", | ||||||
| 			"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | 			"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", | ||||||
|  | @ -128,11 +105,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", | 			"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", | ||||||
| 			"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" | 			"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" | ||||||
| 		}, | 		}, | ||||||
| 		"es6-promise": { |  | ||||||
| 			"version": "3.2.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.2.1.tgz", |  | ||||||
| 			"integrity": "sha1-7FYjOGgDKQkgcXDDlEjiREndH8Q=" |  | ||||||
| 		}, |  | ||||||
| 		"escape-html": { | 		"escape-html": { | ||||||
| 			"version": "1.0.3", | 			"version": "1.0.3", | ||||||
| 			"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", | 			"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", | ||||||
|  | @ -204,11 +176,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", | 			"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", | ||||||
| 			"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" | 			"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" | ||||||
| 		}, | 		}, | ||||||
| 		"hooks-fixed": { |  | ||||||
| 			"version": "2.0.2", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/hooks-fixed/-/hooks-fixed-2.0.2.tgz", |  | ||||||
| 			"integrity": "sha512-YurCM4gQSetcrhwEtpQHhQ4M7Zo7poNGqY4kQGeBS6eZtOcT3tnNs01ThFa0jYBByAiYt1MjMjP/YApG0EnAvQ==" |  | ||||||
| 		}, |  | ||||||
| 		"http-errors": { | 		"http-errors": { | ||||||
| 			"version": "1.7.2", | 			"version": "1.7.2", | ||||||
| 			"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", | 			"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", | ||||||
|  | @ -239,26 +206,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", | 			"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", | ||||||
| 			"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" | 			"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==" | ||||||
| 		}, | 		}, | ||||||
| 		"isarray": { |  | ||||||
| 			"version": "1.0.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", |  | ||||||
| 			"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" |  | ||||||
| 		}, |  | ||||||
| 		"kareem": { |  | ||||||
| 			"version": "1.5.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/kareem/-/kareem-1.5.0.tgz", |  | ||||||
| 			"integrity": "sha1-4+QQHZ3P3imXadr0tNtk2JXRdEg=" |  | ||||||
| 		}, |  | ||||||
| 		"lodash": { |  | ||||||
| 			"version": "4.17.15", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", |  | ||||||
| 			"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" |  | ||||||
| 		}, |  | ||||||
| 		"lodash.get": { |  | ||||||
| 			"version": "4.4.2", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", |  | ||||||
| 			"integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=" |  | ||||||
| 		}, |  | ||||||
| 		"media-typer": { | 		"media-typer": { | ||||||
| 			"version": "0.3.0", | 			"version": "0.3.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", | 			"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", | ||||||
|  | @ -292,109 +239,11 @@ | ||||||
| 				"mime-db": "1.44.0" | 				"mime-db": "1.44.0" | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"mongodb": { |  | ||||||
| 			"version": "2.2.36", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.36.tgz", |  | ||||||
| 			"integrity": "sha512-P2SBLQ8Z0PVx71ngoXwo12+FiSfbNfGOClAao03/bant5DgLNkOPAck5IaJcEk4gKlQhDEURzfR3xuBG1/B+IA==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"es6-promise": "3.2.1", |  | ||||||
| 				"mongodb-core": "2.1.20", |  | ||||||
| 				"readable-stream": "2.2.7" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"mongodb-core": { |  | ||||||
| 			"version": "2.1.20", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.20.tgz", |  | ||||||
| 			"integrity": "sha512-IN57CX5/Q1bhDq6ShAR6gIv4koFsZP7L8WOK1S0lR0pVDQaScffSMV5jxubLsmZ7J+UdqmykKw4r9hG3XQEGgQ==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"bson": "~1.0.4", |  | ||||||
| 				"require_optional": "~1.0.0" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"mongoose": { |  | ||||||
| 			"version": "4.13.20", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-4.13.20.tgz", |  | ||||||
| 			"integrity": "sha512-lyOoXg/+S8VmW7gh816H9QcBSqLMCOXecVxflES729lb3qAU3W/AHLbCpHSIPFDJW5mXs4z5sCsjuLBa56w1Jg==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"async": "2.6.0", |  | ||||||
| 				"bson": "~1.0.4", |  | ||||||
| 				"hooks-fixed": "2.0.2", |  | ||||||
| 				"kareem": "1.5.0", |  | ||||||
| 				"lodash.get": "4.4.2", |  | ||||||
| 				"mongodb": "2.2.34", |  | ||||||
| 				"mpath": "0.5.1", |  | ||||||
| 				"mpromise": "0.5.5", |  | ||||||
| 				"mquery": "2.3.3", |  | ||||||
| 				"ms": "2.0.0", |  | ||||||
| 				"muri": "1.3.0", |  | ||||||
| 				"regexp-clone": "0.0.1", |  | ||||||
| 				"sliced": "1.0.1" |  | ||||||
| 			}, |  | ||||||
| 			"dependencies": { |  | ||||||
| 				"mongodb": { |  | ||||||
| 					"version": "2.2.34", |  | ||||||
| 					"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.2.34.tgz", |  | ||||||
| 					"integrity": "sha1-o09Zu+thdUrsQy3nLD/iFSakTBo=", |  | ||||||
| 					"requires": { |  | ||||||
| 						"es6-promise": "3.2.1", |  | ||||||
| 						"mongodb-core": "2.1.18", |  | ||||||
| 						"readable-stream": "2.2.7" |  | ||||||
| 					} |  | ||||||
| 				}, |  | ||||||
| 				"mongodb-core": { |  | ||||||
| 					"version": "2.1.18", |  | ||||||
| 					"resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-2.1.18.tgz", |  | ||||||
| 					"integrity": "sha1-TEYTm986HwMt7ZHbSfOO7AFlkFA=", |  | ||||||
| 					"requires": { |  | ||||||
| 						"bson": "~1.0.4", |  | ||||||
| 						"require_optional": "~1.0.0" |  | ||||||
| 					} |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"mpath": { |  | ||||||
| 			"version": "0.5.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mpath/-/mpath-0.5.1.tgz", |  | ||||||
| 			"integrity": "sha512-H8OVQ+QEz82sch4wbODFOz+3YQ61FYz/z3eJ5pIdbMEaUzDqA268Wd+Vt4Paw9TJfvDgVKaayC0gBzMIw2jhsg==" |  | ||||||
| 		}, |  | ||||||
| 		"mpromise": { |  | ||||||
| 			"version": "0.5.5", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mpromise/-/mpromise-0.5.5.tgz", |  | ||||||
| 			"integrity": "sha1-9bJCWddjrMIlewoMjG2Gb9UXMuY=" |  | ||||||
| 		}, |  | ||||||
| 		"mquery": { |  | ||||||
| 			"version": "2.3.3", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/mquery/-/mquery-2.3.3.tgz", |  | ||||||
| 			"integrity": "sha512-NC8L14kn+qxJbbJ1gbcEMDxF0sC3sv+1cbRReXXwVvowcwY1y9KoVZFq0ebwARibsadu8lx8nWGvm3V0Pf0ZWQ==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"bluebird": "3.5.0", |  | ||||||
| 				"debug": "2.6.9", |  | ||||||
| 				"regexp-clone": "0.0.1", |  | ||||||
| 				"sliced": "0.0.5" |  | ||||||
| 			}, |  | ||||||
| 			"dependencies": { |  | ||||||
| 				"sliced": { |  | ||||||
| 					"version": "0.0.5", |  | ||||||
| 					"resolved": "https://registry.npmjs.org/sliced/-/sliced-0.0.5.tgz", |  | ||||||
| 					"integrity": "sha1-XtwETKTrb3gW1Qui/GPiXY/kcH8=" |  | ||||||
| 				} |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"ms": { | 		"ms": { | ||||||
| 			"version": "2.0.0", | 			"version": "2.0.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", | 			"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", | ||||||
| 			"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" | 			"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" | ||||||
| 		}, | 		}, | ||||||
| 		"muri": { |  | ||||||
| 			"version": "1.3.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/muri/-/muri-1.3.0.tgz", |  | ||||||
| 			"integrity": "sha512-FiaFwKl864onHFFUV/a2szAl7X0fxVlSKNdhTf+BM8i8goEgYut8u5P9MqQqIYwvaMxjzVESsoEm/2kfkFH1rg==" |  | ||||||
| 		}, |  | ||||||
| 		"nanoid": { |  | ||||||
| 			"version": "2.1.11", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-2.1.11.tgz", |  | ||||||
| 			"integrity": "sha512-s/snB+WGm6uwi0WjsZdaVcuf3KJXlfGl2LcxgwkEwJF0D/BWzVWAZW/XY4bFaiR7s0Jk3FPvlnepg1H1b1UwlA==" |  | ||||||
| 		}, |  | ||||||
| 		"negotiator": { | 		"negotiator": { | ||||||
| 			"version": "0.6.2", | 			"version": "0.6.2", | ||||||
| 			"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", | 			"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", | ||||||
|  | @ -423,11 +272,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", | 			"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", | ||||||
| 			"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" | 			"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" | ||||||
| 		}, | 		}, | ||||||
| 		"process-nextick-args": { |  | ||||||
| 			"version": "1.0.7", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", |  | ||||||
| 			"integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" |  | ||||||
| 		}, |  | ||||||
| 		"proxy-addr": { | 		"proxy-addr": { | ||||||
| 			"version": "2.0.6", | 			"version": "2.0.6", | ||||||
| 			"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", | 			"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", | ||||||
|  | @ -458,39 +302,6 @@ | ||||||
| 				"unpipe": "1.0.0" | 				"unpipe": "1.0.0" | ||||||
| 			} | 			} | ||||||
| 		}, | 		}, | ||||||
| 		"readable-stream": { |  | ||||||
| 			"version": "2.2.7", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.7.tgz", |  | ||||||
| 			"integrity": "sha1-BwV6y+JGeyIELTb5jFrVBwVOlbE=", |  | ||||||
| 			"requires": { |  | ||||||
| 				"buffer-shims": "~1.0.0", |  | ||||||
| 				"core-util-is": "~1.0.0", |  | ||||||
| 				"inherits": "~2.0.1", |  | ||||||
| 				"isarray": "~1.0.0", |  | ||||||
| 				"process-nextick-args": "~1.0.6", |  | ||||||
| 				"string_decoder": "~1.0.0", |  | ||||||
| 				"util-deprecate": "~1.0.1" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"regexp-clone": { |  | ||||||
| 			"version": "0.0.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/regexp-clone/-/regexp-clone-0.0.1.tgz", |  | ||||||
| 			"integrity": "sha1-p8LgmJH9vzj7sQ03b7cwA+aKxYk=" |  | ||||||
| 		}, |  | ||||||
| 		"require_optional": { |  | ||||||
| 			"version": "1.0.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/require_optional/-/require_optional-1.0.1.tgz", |  | ||||||
| 			"integrity": "sha512-qhM/y57enGWHAe3v/NcwML6a3/vfESLe/sGM2dII+gEO0BpKRUkWZow/tyloNqJyN6kXSl3RyyM8Ll5D/sJP8g==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"resolve-from": "^2.0.0", |  | ||||||
| 				"semver": "^5.1.0" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"resolve-from": { |  | ||||||
| 			"version": "2.0.0", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-2.0.0.tgz", |  | ||||||
| 			"integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" |  | ||||||
| 		}, |  | ||||||
| 		"safe-buffer": { | 		"safe-buffer": { | ||||||
| 			"version": "5.1.2", | 			"version": "5.1.2", | ||||||
| 			"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", | 			"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", | ||||||
|  | @ -501,11 +312,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", | 			"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", | ||||||
| 			"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" | 			"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" | ||||||
| 		}, | 		}, | ||||||
| 		"semver": { |  | ||||||
| 			"version": "5.7.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", |  | ||||||
| 			"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" |  | ||||||
| 		}, |  | ||||||
| 		"send": { | 		"send": { | ||||||
| 			"version": "0.17.1", | 			"version": "0.17.1", | ||||||
| 			"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", | 			"resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", | ||||||
|  | @ -549,32 +355,11 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", | 			"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", | ||||||
| 			"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" | 			"integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" | ||||||
| 		}, | 		}, | ||||||
| 		"shortid": { |  | ||||||
| 			"version": "2.2.15", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.15.tgz", |  | ||||||
| 			"integrity": "sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"nanoid": "^2.1.0" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"sliced": { |  | ||||||
| 			"version": "1.0.1", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/sliced/-/sliced-1.0.1.tgz", |  | ||||||
| 			"integrity": "sha1-CzpmK10Ewxd7GSa+qCsD+Dei70E=" |  | ||||||
| 		}, |  | ||||||
| 		"statuses": { | 		"statuses": { | ||||||
| 			"version": "1.5.0", | 			"version": "1.5.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", | 			"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", | ||||||
| 			"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" | 			"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" | ||||||
| 		}, | 		}, | ||||||
| 		"string_decoder": { |  | ||||||
| 			"version": "1.0.3", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", |  | ||||||
| 			"integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", |  | ||||||
| 			"requires": { |  | ||||||
| 				"safe-buffer": "~5.1.0" |  | ||||||
| 			} |  | ||||||
| 		}, |  | ||||||
| 		"toidentifier": { | 		"toidentifier": { | ||||||
| 			"version": "1.0.0", | 			"version": "1.0.0", | ||||||
| 			"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", | 			"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", | ||||||
|  | @ -594,11 +379,6 @@ | ||||||
| 			"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", | 			"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", | ||||||
| 			"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" | 			"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" | ||||||
| 		}, | 		}, | ||||||
| 		"util-deprecate": { |  | ||||||
| 			"version": "1.0.2", |  | ||||||
| 			"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", |  | ||||||
| 			"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" |  | ||||||
| 		}, |  | ||||||
| 		"utils-merge": { | 		"utils-merge": { | ||||||
| 			"version": "1.0.1", | 			"version": "1.0.1", | ||||||
| 			"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", | 			"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", | ||||||
|  |  | ||||||
							
								
								
									
										10
									
								
								package.json
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								package.json
									
										
									
									
									
								
							|  | @ -7,23 +7,19 @@ | ||||||
| 		"start": "node server.js" | 		"start": "node server.js" | ||||||
| 	}, | 	}, | ||||||
| 	"dependencies": { | 	"dependencies": { | ||||||
|  | 		"dotenv": "^8.2.0", | ||||||
| 		"express": "^4.16.4", | 		"express": "^4.16.4", | ||||||
| 		"mongoose": "^5.7.7", | 		"cors": "^2.8.5" | ||||||
| 		"mongodb": "^3.3.2", |  | ||||||
| 		"body-parser": "^1.19.0", |  | ||||||
| 		"cors": "^2.8.5", |  | ||||||
| 		"shortid": "^2.2.15" |  | ||||||
| 	}, | 	}, | ||||||
| 	"engines": { | 	"engines": { | ||||||
| 		"node": "12.0.0" | 		"node": "12.0.0" | ||||||
| 	}, | 	}, | ||||||
| 	"repository": { | 	"repository": { | ||||||
| 		"url": "https://gomix.com/#!/project/welcome-project" | 		"url": "https://github.com/freeCodeCamp/boilerplate-project-exercisetracker" | ||||||
| 	}, | 	}, | ||||||
| 	"license": "MIT", | 	"license": "MIT", | ||||||
| 	"keywords": [ | 	"keywords": [ | ||||||
| 		"node", | 		"node", | ||||||
| 		"gomix", |  | ||||||
| 		"express" | 		"express" | ||||||
| 	] | 	] | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -1,4 +1,3 @@ | ||||||
| 
 |  | ||||||
| * { | * { | ||||||
|   box-sizing: border-box; |   box-sizing: border-box; | ||||||
| } | } | ||||||
|  | @ -15,10 +14,6 @@ h1 { | ||||||
|    |    | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| .bold { |  | ||||||
|   font-weight: bold; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| p { | p { | ||||||
|   max-width: 900px; |   max-width: 900px; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										1
									
								
								sample.env
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								sample.env
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | ||||||
|  | PORT=3000 | ||||||
							
								
								
									
										32
									
								
								server.js
									
										
									
									
									
								
							
							
						
						
									
										32
									
								
								server.js
									
										
									
									
									
								
							|  | @ -1,47 +1,17 @@ | ||||||
| const express = require('express') | const express = require('express') | ||||||
| const app = express() | const app = express() | ||||||
| const bodyParser = require('body-parser') |  | ||||||
| 
 |  | ||||||
| const cors = require('cors') | const cors = require('cors') | ||||||
| 
 | require('dotenv').config() | ||||||
| const mongoose = require('mongoose') |  | ||||||
| mongoose.connect(process.env.MLAB_URI || 'mongodb://localhost/exercise-track', { useMongoClient: true } ) |  | ||||||
| 
 | 
 | ||||||
| app.use(cors()) | app.use(cors()) | ||||||
| 
 |  | ||||||
| app.use(bodyParser.urlencoded({extended: false})) |  | ||||||
| app.use(bodyParser.json()) |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| app.use(express.static('public')) | app.use(express.static('public')) | ||||||
| app.get('/', (req, res) => { | app.get('/', (req, res) => { | ||||||
|   res.sendFile(__dirname + '/views/index.html') |   res.sendFile(__dirname + '/views/index.html') | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Not found middleware
 |  | ||||||
| app.use((req, res, next) => { |  | ||||||
|   return next({status: 404, message: 'not found'}) |  | ||||||
| }) |  | ||||||
| 
 | 
 | ||||||
| // Error Handling middleware
 |  | ||||||
| app.use((err, req, res, next) => { |  | ||||||
|   let errCode, errMessage |  | ||||||
| 
 | 
 | ||||||
|   if (err.errors) { |  | ||||||
|     // mongoose validation error
 |  | ||||||
|     errCode = 400 // bad request
 |  | ||||||
|     const keys = Object.keys(err.errors) |  | ||||||
|     // report the first validation error
 |  | ||||||
|     errMessage = err.errors[keys[0]].message |  | ||||||
|   } else { |  | ||||||
|     // generic or custom error
 |  | ||||||
|     errCode = err.status || 500 |  | ||||||
|     errMessage = err.message || 'Internal Server Error' |  | ||||||
|   } |  | ||||||
|   res.status(errCode).type('txt') |  | ||||||
|     .send(errMessage) |  | ||||||
| }) |  | ||||||
| 
 | 
 | ||||||
| const listener = app.listen(process.env.PORT || 3000, () => { | const listener = app.listen(process.env.PORT || 3000, () => { | ||||||
|   console.log('Your app is listening on port ' + listener.address().port) |   console.log('Your app is listening on port ' + listener.address().port) | ||||||
|  |  | ||||||
|  | @ -3,7 +3,7 @@ | ||||||
| 
 | 
 | ||||||
|    <head> |    <head> | ||||||
|       <title>Exercise Tracker | Free Code Camp</title> |       <title>Exercise Tracker | Free Code Camp</title> | ||||||
|       <link rel="shortcut icon" href="https://cdn.hyperdev.com/us-east-1%3A52a203ff-088b-420f-81be-45bf559d01b1%2Ffavicon.ico" type="image/x-icon"/> |       <link rel="shortcut icon" href="https://cdn.freecodecamp.org/universal/favicons/favicon-32x32.png" type="image/x-icon"/> | ||||||
|       <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"> |       <link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css"> | ||||||
|       <link href="style.css" rel="stylesheet" type="text/css"> |       <link href="style.css" rel="stylesheet" type="text/css"> | ||||||
|    </head> |    </head> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue