added folder public

parent a6fa3afe
...@@ -15,7 +15,7 @@ app.use(json()); ...@@ -15,7 +15,7 @@ app.use(json());
app.use(cors()); app.use(cors());
app.use(urlencoded({extended: true})); app.use(urlencoded({extended: true}));
app.use(express.static('uploads')); app.use(express.static('public/uploads'));
app.use('/artists', ArtistRouter); app.use('/artists', ArtistRouter);
app.use('/albums', AlbumRouter); app.use('/albums', AlbumRouter);
app.use('/tracks', TrackRouter); app.use('/tracks', TrackRouter);
......
...@@ -2,7 +2,7 @@ import expres, {Router} from 'express'; ...@@ -2,7 +2,7 @@ import expres, {Router} from 'express';
import multer from 'multer'; import multer from 'multer';
import {AlbumController} from '../controllers/album'; import {AlbumController} from '../controllers/album';
const upload = multer({dest: 'uploads'}); const upload = multer({dest: 'public/uploads'});
const router: Router = expres.Router(); const router: Router = expres.Router();
router.get('/', AlbumController.getAlbums); router.get('/', AlbumController.getAlbums);
......
...@@ -20,6 +20,7 @@ export async function login(user: IUser) { ...@@ -20,6 +20,7 @@ export async function login(user: IUser) {
throw new Error('Name of user is not correct'); throw new Error('Name of user is not correct');
} }
const isMatch = bcrypt.compareSync(user.password, foundUser.password); const isMatch = bcrypt.compareSync(user.password, foundUser.password);
if (isMatch) { if (isMatch) {
const token = jwt.sign( const token = jwt.sign(
{_id: foundUser._id?.toString(), username: foundUser.username}, {_id: foundUser._id?.toString(), username: foundUser.username},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment