- Work in a fork of this repository
- Work in a branch on your fork
- Write all of your code in a directory named
lab-
+<your name>
e.g.lab-susan
- Open a pull request to this repository
- Submit on canvas a question and observation, how long you spent, and a link to your pull request
Configure the root of your repository with the following files and directories. Thoughtfully name and organize any additional configuration or module files.
- README.md - contains documentation
- .env - contains env variables (should be git ignored)
- .gitignore - contains a robust
.gitignore
file - .eslintrc.json - contains the course linter configuration
- .eslintignore - contains the course linter ignore configuration
- package.json - contains npm package config
- create a
lint
script for running eslint - create a
test
script for running tests - create a
start
script for running your server - create
dbon
anddboff
scripts for managing the mongo daemon
- create a
- db/ - contains mongodb files (should be git ignored)
- lib/ - contains module definitions
- model/ - contains module definitions
- route/ - contains module definitions
- __test__/ - contains test modules
For this assignment you will be building a RESTful HTTP server with basic authentication using express.
Create a user Account
model that keeps track of a username, email, hashed password, and token seed. The model should be able to regenerate tokens using json web token.
POST /signup
- pass data as stringifed JSON in the body of a POST request to create a new account
- on success respond with a 200 status code and an authentication token
- on failure due to a bad request send a 400 status code
- POST should test for 200, 400, and 409 (if any keys are unique)
In the README.md write documentation for starting your server and making requests to each endpoint it provides. The documentation should describe how the server would respond to valid and invalid requests.