This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { body, validationResult } = require('express-validator'); | |
// Validation docs: | |
// - https://www.npmjs.com/package/express-validator | |
// - https://express-validator.github.io/docs | |
// A validation chain has three kinds of methods: validators, sanitizers and modifiers. - https://express-validator.github.io/docs/guides/validation-chain#features | |
/** USER */ | |
// TODO Login - https://stackoverflow.com/questions/62630504/express-validator-isdate-and-isiso8601-are-always-false | |
const userValidationRules = () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const users = express.Router(); | |
const usersController = require('../controllers/users'); | |
const { userValidationRules, validate } = require('../middleware/validate'); | |
/** USERS */ | |
// List | |
users.get('/', usersController.getData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Markham, Michelle | |
/* global module */ | |
//To create a new controller, you only need to copy this code and change 2 items: | |
//1. dbTitle = new collection name | |
//2. dbFieldsArray = fields in the new collection | |
const mongodb = require('../db/connect'); | |
const ObjectId = require('mongodb').ObjectId; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { MongoClient, ObjectId } = require('mongodb'); | |
describe('insert', () => { | |
let connection; | |
let db; | |
beforeAll(async () => { | |
connection = await MongoClient.connect(globalThis.__MONGO_URI__, { | |
useNewUrlParser: true, | |
useUnifiedTopology: true |
NewerOlder