Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
H
hw92
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
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
Болатов Ален
hw92
Commits
b291f9ec
Commit
b291f9ec
authored
Apr 01, 2023
by
Рахметова Альбина
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '
#17
' into 'dev'
file index changed to class component See merge request
!18
parents
40667cb7
d3d46475
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
14 deletions
+29
-14
.env
backend/.env
+1
-1
index.ts
backend/src/index.ts
+28
-13
No files found.
backend/.env
View file @
b291f9ec
MONGO_URL='mongodb://localhost:27017'
PORT='3000'
\ No newline at end of file
PORT='8002'
\ No newline at end of file
backend/src/index.ts
View file @
b291f9ec
...
...
@@ -6,19 +6,34 @@ import {UsersRouter} from './routes/user';
import
{
CommentController
}
from
'./controllers/comments'
;
import
{
PostsController
}
from
'./controllers/posts'
;
mongo
.
run
();
const
app
:
Express
=
express
();
app
.
use
(
json
());
app
.
use
(
cors
());
app
.
use
(
urlencoded
({
extended
:
true
}));
class
App
{
private
app
:
Express
constructor
()
{
this
.
app
=
express
()
this
.
app
.
use
(
express
.
json
())
this
.
app
.
use
(
express
.
static
(
'public'
))
this
.
app
.
use
(
express
.
urlencoded
({
extended
:
true
}));
this
.
app
.
use
(
cors
())
}
app
.
use
(
express
.
static
(
'public/uploads'
));
app
.
use
(
'/users'
,
UsersRouter
);
app
.
use
(
'/posts'
,
new
PostsController
().
getRouter
())
app
.
use
(
'/comments'
,
new
CommentController
().
getRouter
())
app
.
use
(
'/comments'
,
new
CommentController
().
getRouter
())
public
init
=
async
():
Promise
<
void
>
=>
{
try
{
await
mongo
.
init
()
process
.
on
(
'exit'
,
()
=>
{
mongo
.
close
()
})
this
.
app
.
use
(
'/posts'
,
new
PostsController
().
getRouter
())
this
.
app
.
use
(
'/users'
,
UsersRouter
)
this
.
app
.
use
(
'/comments'
,
new
CommentController
().
getRouter
())
this
.
app
.
listen
(
process
.
env
.
PORT
,
()
=>
{
console
.
log
(
`Server is running on port
${
process
.
env
.
PORT
}
`
)
})
}
catch
(
err
:
unknown
)
{
console
.
log
(
err
)
}
}
}
app
.
listen
(
process
.
env
.
PORT
,
()
=>
{
console
.
log
(
`App started on port
${
process
.
env
.
PORT
}
`
);
});
const
app
=
new
App
()
app
.
init
()
\ No newline at end of file
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