Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
Homework_89_Tsoy_Danil
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Цой Данил
Homework_89_Tsoy_Danil
Commits
cd4dc7ce
Commit
cd4dc7ce
authored
Mar 22, 2023
by
Цой Данил
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Homework 89
#4
#5
#6
rewrote old controllers. Now call const now class directly
parent
afed28db
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
11 deletions
+22
-11
albumsController.ts
src/controllers/albumsController.ts
+1
-0
artistsController.ts
src/controllers/artistsController.ts
+3
-1
healthCheck.ts
src/controllers/healthCheck.ts
+2
-0
tracksController.ts
src/controllers/tracksController.ts
+3
-1
usersController.ts
src/controllers/usersController.ts
+3
-1
index.ts
src/index.ts
+10
-8
No files found.
src/controllers/albumsController.ts
View file @
cd4dc7ce
...
...
@@ -53,3 +53,4 @@ export class AlbumsController {
}
}
export
const
albumsController
=
new
AlbumsController
()
\ No newline at end of file
src/controllers/artistsController.ts
View file @
cd4dc7ce
...
...
@@ -50,4 +50,6 @@ export class ArtistsController {
res
.
send
(
response
)
}
}
}
\ No newline at end of file
}
export
const
artistsController
=
new
ArtistsController
()
\ No newline at end of file
src/controllers/healthCheck.ts
View file @
cd4dc7ce
...
...
@@ -16,3 +16,5 @@ export class HealthCheckController {
res
.
send
(
'Server is OK'
)
}
}
export
const
healthCheckController
=
new
HealthCheckController
()
\ No newline at end of file
src/controllers/tracksController.ts
View file @
cd4dc7ce
...
...
@@ -36,4 +36,6 @@ export class TracksController {
res
.
send
(
response
)
}
}
}
\ No newline at end of file
}
export
const
tracksController
=
new
TracksController
()
\ No newline at end of file
src/controllers/usersController.ts
View file @
cd4dc7ce
...
...
@@ -27,4 +27,6 @@ export class UsersController {
const
response
:
IResponse
<
IUser
|
null
>
=
await
this
.
service
.
loginUser
(
req
.
body
)
res
.
status
(
200
).
send
(
response
)
}
}
\ No newline at end of file
}
export
const
usersController
=
new
UsersController
()
\ No newline at end of file
src/index.ts
View file @
cd4dc7ce
import
express
,
{
Express
}
from
"express"
;
import
dotenv
from
'dotenv'
;
import
cors
from
'cors'
;
import
{
HealthCheckController
}
from
"./controllers/healthCheck"
;
import
{
healthCheckController
,
HealthCheckController
}
from
"./controllers/healthCheck"
;
import
{
mongooseDB
}
from
"./repository/mongooseDB"
;
import
{
ArtistsController
}
from
"./controllers/artistsController"
;
import
{
AlbumsController
}
from
"./controllers/albumsController"
;
import
{
TracksController
}
from
"./controllers/tracksController"
;
import
{
artistsController
,
ArtistsController
}
from
"./controllers/artistsController"
;
import
{
albumsController
,
AlbumsController
}
from
"./controllers/albumsController"
;
import
{
tracksController
,
TracksController
}
from
"./controllers/tracksController"
;
import
{
usersController
}
from
"./controllers/usersController"
;
dotenv
.
config
()
...
...
@@ -20,10 +21,11 @@ class App {
public
init
=
async
():
Promise
<
void
>
=>
{
try
{
this
.
app
.
use
(
'/health-check'
,
new
HealthCheckController
().
getRouter
())
this
.
app
.
use
(
'/artists'
,
new
ArtistsController
().
getRouter
())
this
.
app
.
use
(
'/albums'
,
new
AlbumsController
().
getRouter
())
this
.
app
.
use
(
'/tracks'
,
new
TracksController
().
getRouter
())
this
.
app
.
use
(
'/health-check'
,
healthCheckController
.
getRouter
())
this
.
app
.
use
(
'/artists'
,
artistsController
.
getRouter
())
this
.
app
.
use
(
'/albums'
,
albumsController
.
getRouter
())
this
.
app
.
use
(
'/tracks'
,
tracksController
.
getRouter
())
this
.
app
.
use
(
'/users'
,
usersController
.
getRouter
())
this
.
app
.
listen
(
process
.
env
.
APP_PORT
,
()
=>
{
console
.
log
(
`Server is running on http://localhost:
${
process
.
env
.
APP_PORT
}
`
)
})
...
...
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