Back End Development - Andrew-Casner/Sportrakker GitHub Wiki
Back End Development
Tools
Structure
The server folder holds all of the back-end data that runs the api routs, the database, and all other back-end needs.
app
The app folder holds most of the javascript code that runs the back-end.
models
The models folder holds all of the schema files for the database. MongoDB uses sachemas to define the json object it will store in the database. Each model file should have the same name as the routes file it is associated to. Learn how to create a new schema file here.
Current Schemas
- player.js
- organization.js
- team.js
- staff.js
- athlete.js
routes
The routes folder holds all of the route files for the api. Express.js uses a RESTful design scheme to define routes to allow communication to the database. Each schema needs to have a routes file with the same name. Each routes file needs to provide only the gets and sets that are required at the time. If you do not need to write to a specific variable in that schema there is no need to define a route that does this. If a route is needed then you can go in and create a route for your needs. Learn how to create a new route file here.
Current Routes
- player.js
- api/player
- post
- get
- api/player
- organization.js
- api/organization
- post
- get
- api/organization
- team.js
- api/team
- post
- get
- api/team
- staff.js
- api/staff
- post
- get
- api/staff
- athlete.js
- api/athlete
- post
- get
- api/athlete
config
The config folder contains all of the files necessary to build deploy are run the database.
node_modules
The node_modules folder contains all of the npm packets. You will never have to edit this file.
Run Server
- Run
npm install - Run
npm start - Go to local host port 8080 to view project