Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 401 JS
db
.env
temp
build
# Created by https://www.gitignore.io/api/vim,osx,node,linux,windows
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
### OSX ###
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### Vim ###
# swap
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-v][a-z]
[._]sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags
### Windows ###
# Windows thumbnail cache files
Thumbs.db
ehthumbs.db
ehthumbs_vista.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.gitignore.io/api/vim,osx,node,linux,windows
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
Hi!
# Rest API for testing front end pre-built.

## Usage
Built out initial POL for json server..

**To Use**: `npm i`, `json-server db.json`, use your favorite request program to make a request to:

### routes

GET/categories

POST/categories

auto-assigns id

PUT/categories/:id

DELETE/categories/:id



GET/products

POST/products

PUT/products/:id

DELETE/products/:id

1 change: 1 addition & 0 deletions data/db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
50 changes: 50 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"categories": [
{
"id": 1,
"name": "tyler",
"display_name": "boss",
"description": "da boss"
},
{
"id": 2,
"name": "jim",
"rank": "underboss"
},
{
"name": "bob",
"rank": "underboss",
"id": 3
},
{
"name": "jenny",
"rank": "underboss",
"id": 4
},
{
"name": "jill\n",
"rank": "underboss",
"id": 5
},
{
"rank": "underbos",
"name": "billagin",
"id": 6
},
{
"rank": "underbos",
"name": "hecka",
"description": "poo man foo",
"id": 7
}
],
"products": [
{
"id": 1,
"category": "people",
"name": "tyler",
"display_name": "boss",
"description": "da boss"
}
]
}
42 changes: 42 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const jsonServer = require('json-server');
const app = jsonServer.create();
const router = jsonServer.router('data/db.json');
const middleware = jsonServer.defaults();

app.use(jsonServer.bodyParser)
app.use(middleware);
app.use(router);

// app.get('/categories', (req, res) => {
// })

// app.post('/categories', (req, res) => {

// })

// app.put('/categories/:id', (req, res) => {

// })

// app.delete('/categories/:id', (req, res) => {

// })

// app.get('/products', (req, res) => {

// })

// app.post('/products', (req, res) => {

// })

// app.put('/products/:id', (req, res) => {

// })

// app.delete('/products/:id', (req, res) => {

// })


app.listen(3000, () => { console.log('server up on 3000')});
Loading