Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

add apps routes #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions routes/apps.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
const express = require('express');
const router = express.Router();

const data = require('../data/apps.json');


router.get('/', function(req, res, next) {
res.json( data );
});


router.get('/:id', function(req, res, next) {
const id = parseInt(req.params.id)
const item = data.find(item => item.id === id)
res.json(item || {});
});

module.exports = router;