Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
planner-team-one
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
21
Issues
21
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Евгений Положенцев
planner-team-one
Commits
dcae3430
Commit
dcae3430
authored
Nov 04, 2022
by
“Yevgeniy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#23
added routers for Projects
parent
945f33fa
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
projects.ts
planner-api/src/routers/projects.ts
+17
-2
No files found.
planner-api/src/routers/projects.ts
View file @
dcae3430
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
express
,{
Router
,
Request
,
Response
}
from
'express'
;
import
{
User
}
from
'../models/User
'
;
import
{
Project
}
from
'../models/Project
'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
myDataSource
}
from
'../app-data-source'
;
import
{
nanoid
}
from
'nanoid'
;
const
router
:
Router
=
express
.
Router
();
const
router
:
Router
=
express
.
Router
();
const
dataSource
=
myDataSource
;
const
dataSource
=
myDataSource
;
router
.
get
(
'/'
,
async
(
req
:
Request
,
res
:
Response
)
=>
{
const
projects
:
Project
[]
|
undefined
=
await
dataSource
.
manager
.
find
(
Project
)
return
res
.
send
({
projects
})
})
router
.
get
(
"/:project_id"
,
async
(
req
:
Request
,
res
:
Response
)
=>
{
const
project
:
Project
|
null
=
await
dataSource
.
manager
.
findOneBy
(
Project
,
{
id
:
req
.
params
.
project_id
})
if
(
!
project
)
return
res
.
status
(
404
).
send
({
Message
:
'no info in the base'
})
return
res
.
send
({
project
})
})
export
default
router
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment