Express Flashcards
How do you refer to an Express router?
Call the express object’s Router() method to create a new router object:
const router = express.Router();
In Express, how do you start the server on a specific port?
app.listen(port_number, () => doSomething());
In Express, what does “app.use” do?
It adds a layer to the Express “middleware stack”
In Express, what does the following line do?
app.use(./local/path, pathVariable);
Whenever a request is made to /local/path, the pathVariable is the endpoint that is actually hit
When writing a Mongoose schema file, what should the export statement look like (pre-ES6)?
module.exports = Item = mongoose.model(‘item’, ItemSchema)
What is Express(.js)?
A backend framework for creating APIs