Some syntax changes

This commit is contained in:
2021-10-15 02:19:06 +03:00
parent 625c55a083
commit 1912baeeab
2 changed files with 3 additions and 3 deletions

View File

@@ -13,7 +13,7 @@ const db = new NotesService()
* @param res
* @returns {Promise<void>}
*/
export const getAllNotes = async (req, res) => {
export const notesIndex = async (req, res) => {
try{
const data = await db.getNotes
res.status(data.code || 200).json(data)

View File

@@ -1,6 +1,6 @@
import { Router } from 'express'
import { addNote } from './methods/post.js'
import { getAllNotes, getSingleNote, getStats } from './methods/get.js'
import { notesIndex, getSingleNote, getStats } from './methods/get.js'
import { editNote } from './methods/patch.js'
import { deleteNote } from './methods/delete.js'
import { id as validate } from '../services/ValidationService.js'
@@ -20,7 +20,7 @@ const setForbidden = async (req, res) => {
const router = new Router()
router.get('/notes(\/|)$/', getAllNotes)
router.get('/notes(\/|)$/', notesIndex)
router.get('/notes\/stats(\/|)$/', getStats)
router.get('/notes/:id([0-9]{1,4})$/', validate(idOnlySchema), getSingleNote) // e.g. also notes with `0x1a` => id = 26 will be affected
router.get('*', setForbidden)