2024-10-16 11:06:23 +03:00
|
|
|
const rootRouter = require('express').Router()
|
|
|
|
const data = require('../data.json')
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/nickname', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.nickname })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/tech-stack', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.techStack })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/github-repo', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.githubRepo })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/city', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.city })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/nav-links', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.navLinks })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/links', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.links })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/projects', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ 'status': 'OK', 'data': data.projects })
|
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
rootRouter.get('/get/projects/:id', (req, res) => {
|
2024-10-16 11:06:23 +03:00
|
|
|
const { id } = req.params
|
|
|
|
const project = data.projects.find(p => p.id === id)
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
if (project) {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(200).send({ status: 'OK', data: project })
|
2024-10-12 13:04:51 +03:00
|
|
|
} else {
|
2024-10-16 11:06:23 +03:00
|
|
|
res.status(404).send({ status: 'NOT_FOUND', message: 'Project not found' })
|
2024-10-12 13:04:51 +03:00
|
|
|
}
|
2024-10-16 11:06:23 +03:00
|
|
|
})
|
2024-10-12 13:04:51 +03:00
|
|
|
|
|
|
|
|
2024-10-16 11:06:23 +03:00
|
|
|
module.exports = rootRouter
|