Comments (3)
Facet is a silly word for this example, I keep meaning to change it but havent yet. It's just a collection of objects - normally you'd be using a database of some kind, we're just using an Array as a stand-in for a simple in-memory collection.
resource-router-middleware
is used here because it promotes idiomatic REST - simple CRUD, guids for resources, etc. It's also a convenient way to automatically load a model instance (or fetch an object from a DB or something) for requests that will need access to it.
You can absolutely use this repo without resource-router-middleware
, but I would still strongly recommend keeping the middleware semantic - export a factory function that returns an express Router so it can be instantiated and mounted as necessary. Without this, applications tend to devolve into singletons, which are much harder to re-use, test and refactor. You can see a direct example of the middleware factory approach here that doesn't use resource-router-middleware.
from express-es6-rest-api.
If you have any further questions @amberley please feel free to re-open or ask at anytime!
I'll try my best to update the docs asap with explanation.
from express-es6-rest-api.
@zouhir I really need an explanation to this. I really don't have an idea where to put this logically into. I would love to see an explanation to this 👍 Thanks in advance!
from express-es6-rest-api.
Related Issues (20)
- async/await syntax HOT 3
- Docker Deployment: 404 HOT 1
- "babel: not found" while deploying to heroku HOT 12
- No longer works (most likely due to new modules) HOT 1
- Question about middleware HOT 2
- How add custom API? HOT 1
- How to set environment variables? HOT 1
- node dist failure HOT 1
- can you add an example of how to use with mongoose-restful
- why not use babel-preset-env
- How to import models?
- 404 but the object is still returned HOT 1
- Add a test for /src/api/facets.js HOT 1
- to test DELETE method, AND PUT
- nv
- sh: babel: command not found
- Requires Babel "^7.0.0-0", but was loaded with "6.26.3".
- seems to have stopped updating, wash wash and sleep
- how to change port? HOT 4
- Bodyparser package is deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from express-es6-rest-api.