Loading repository data…
Loading repository data…
lillianparis / repository
This template is a starter guide for Mongoose. Here are a few examples of how to set up mongoose. The MongoDB shell is being used as well.
The Project 3 Starter Kit is a highly opinionated, preconfigured MVC-style full-stack application intended to satisfy the stated requirements and additional requirements of Project 3. It comes with a prerolled authentication system, some cleanup from the project 2 starter, and eslint configuration.
This readme only explains the server. As it is the server readme!
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them
Node.js
a local instance of Mongo DB
an active internet connection
A step by step series of examples that tell you how to get a development env running
First, install all dependencies through npm or yarn. Make sure you use one or the other, if you are going to use yarn, just use yarn.
npm install
OR
yarn
Next, we need to put in your configuration for the server in a .env file in the root of the project. It should look something along the lines of:
NODE_ENV=development
MONGODB_URI=
SECRET=passwordsecret
You will also need to put in a SECRET of at least 10 characters, for the tokens for authentication to be generated. If you change this ever, you will need to clean out your local storages!
You will also need to specify the NODE_ENV, so for local work, set it to development as above.
Once you have down that; you are ready to run the server, with:
npm run dev
In the server:
"start": Runs the server, and the server only. Expects a built frontend.
"dev": Runs the server in watch mode, and the starts up the react dev server.
"lint": Lints the server and then runs lint on the client
"fix": ESlint fixes the server and then the client
"client": Runs the client in development mode
"install": Installs the server, and then installs the client.
"build": Builds the client for production
"heroku-postbuild": Hook for Heroku to build the client
In the client:
"start": Start the react development server
"build": Builds a production react app
"test": Runs lint, no other test yet
"lint": Lints the client
"fix": ESlint fixes the client
Currently, the application has no tests, barring lint. Travis settings preconfigured all ready.
The structure of the server application, as produced, is replicated below, with folders marked with - and files marked with *. Below this, please find the detailed description of each file and what it is doing.
- client - see in Client readme
- controllers
* authController.js
* index.js
* notesController.js
* usersController.js
- models
* index.js
* post.js
* user.js
- utils
* middleware.js
* schema.sql
* verifyConfiguration.js
* .eslintignore
* .eslintrc.json
* .gitignore
* .travis.yml
* package.json
* README.md
* server.js
server.js.username and password. All of authentication relies on this. Look at the user/auth controllers to see how to access password IF you need it. It also uses bcryprt.js to encrypt and check our passwords.Add the model to the models folder. Then add it to index.js in the models folder.
Based on the model, you need to:
modelController in the controllers folder.controllers/index.js file.Go to the client. This is all backend.
Please follow the configuration guide supplied in Unit 18/19/20. You will need to:
MONGODB_URI config.NODE_ENV = production in the deployed version.This project is licensed under the MIT License.