npm init npm install express express-generator exlint nodemon // In package,json "scripts": { ... "start": "node ./bin/www", "devstart": "nodemon ./bin/www", "serverstart": "DEBUG=express-locallibrary-tutorial:* npm run devstart" "lint": "eslint src/js" ... } // Express Skeleton using express-generator express <appnam> --view=pug cd <appname> npm install - Linux: DEBUG=express-locallibrary-tutorial:* npm start - Powershell: DEBUG=express-locallibrary-tutorial:* npm start const mongoose = require("mongoose"); const Schema = mongoose.Schema; const dateFormat = require("dateformat"); const AssignmentSchema = new Schema({ title: { type: String, required: true }, description: { type: String, required: true }, deadline: { type: date, required: true }, }); AssignmentSchema.virtual("date").get(function () { return dateFormat(this.timestamp, "mmmm dS, yyyy, h:MM:ss TT"); }); module.exports = mongoose.model("Assignment", AssignmentSchema);
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter