00 - Intro
In this module, we'll be introducing the Workout Log Server challenge.
Purpose
We'd like you to get some practice and have another look at building a server. In order to review what we have studied in this Gitbook, we'd like you to create a new Express Server.
Rationale
You have been served up an enormous amount of material, and now you need practice working with it and repeating it. It will go faster the second time through, and iterative learning will take place. You will essentially be rebuilding what you just did with a few different endpoints.
Criteria
Just to be clear, there are some major criteria. Your server must do the following:
Have User Authentication
Follow an MVC pattern.
Persist data to Postgres.
Use all of the key concepts studied in this Gitbook, including
jwt
,bcrypt
, andmiddleware
.You will build a client later, using React. You do not need a client for this. We will use this to teach client side Authentication with React.
Your endpoints must show signs of having been tested(screenshots of successful Postman request in a
Readme.md
file are always handy)
Required Endpoints
The project should have the following endpoints:
Endpoint
Verb
Description
/api/user/
POST
Allows a new user to be created with a username and password.
/api/login/
POST
Allows log in with an existing user.
/api/log/
POST
Allows users to create a workout log with descriptions, definitions, results, and owner properties.
/api/log/
GET
Gets all logs for an individual user.
/api/log/:id
GET
Gets individual logs by id
for an individual user.
/api/log/:id
PUT
Allows individual logs to be updated by a user.
/api/log/:id
DELETE
Allows individual logs to be deleted by a user.
Data Models
user.js
In addition to the columns automatically generated by Sequelize, the user.js
model requires the following columns and data-types:
Property
Type
username
STRING
passwordhash
STRING
log.js
In addition to the columns automatically generated by Sequelize, the log.js
model requires the following columns and data-types:
Property
Type
description
STRING
definition
STRING
result
STRING
owner
INTEGER
Last updated