Merge branch 'main' of https://github.com/BRAVO68WEB/url-minify into feature/auth-backend

This commit is contained in:
chirag 2022-02-02 02:18:47 +05:30
commit 3248b185c2
10 changed files with 677 additions and 694 deletions

View File

@ -1,10 +1,25 @@
const Minfy = require("../models/minifed_urls")
const base_url = 'https://minfy.xyz/'
module.exports.getAllData = async (req, res) => {
Minfy.find()
.then((data)=>{
res.send(data)
})
.catch((err)=>{
console.error(err)
res.sendStatus(500)
})
}
module.exports.getURLData = async (req, res) => {
try {
const { alias } = req.params
const data = await Minfy.findOne({ alias: alias })
const {
alias
} = req.params
const data = await Minfy.findOne({
alias: alias
})
data.minifiedUrl = base_url + data.alias
return res.send(data)
} catch (err) {
@ -13,6 +28,17 @@ module.exports.getURLData = async (req, res) => {
}
}
module.exports.findUrlById = async (req, res) => {
Minfy.findById(req.params.id).then((data) => {
res.send(data)
})
.catch((err) => {
console.error(err)
res.sendStatus(500)
})
}
module.exports.addURL = async (req, res) => {
req.body.minifiedUrl = base_url + req.body.alias
Minfy.create(req.body)
@ -21,17 +47,17 @@ module.exports.addURL = async (req, res) => {
})
.catch((err)=>{
console.error(err)
res.sendStaus(500)
res.sendStatus(500)
})
}
module.exports.deleteUrlData = async (req,res) =>{
module.exports.deleteUrlData = async (req, res) => {
Minfy.findByIdAndRemove(req.params.id)
.then((data)=>{
res.send("Successfully Deleted")
})
.catch((err)=>{
console.error(err)
res.sendStaus(500)
})
}
.then((data) => {
res.send("Successfully Deleted")
})
.catch((err) => {
console.error(err)
res.sendStaus(500)
})
}

View File

@ -11,6 +11,7 @@ const minifiedUrlSchema = new Schema(
alias: {
type: String,
required: true,
unique: true,
},
minifiedUrl: {
type: String,

View File

@ -3,10 +3,16 @@ const controller = require("../controllers/minify")
const router = Router();
router.get("/all", controller.getAllData)
router.get("/alias/:alias", controller.getURLData)
router.post("/add",controller.addURL)
router.get("/id/:id", controller.findUrlById)
router.delete('/delete/:id',controller.deleteUrlData)
router.patch('/edit/:id', controller.updateUrlData)
module.exports = router;

View File

@ -0,0 +1,13 @@
import React from 'react';
export default function Logo(){
return(
<div className="logo-wrapper">
<svg class="logo" data-name="Layer 4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 53.4 53.31"><path d="M58.84,53.91a9.2,9.2,0,0,1-6.54-2.72L50.14,49a2.59,2.59,0,1,1,3.67-3.66L56,47.53a4.07,4.07,0,0,0,5.76,0L75.24,34.08a4.08,4.08,0,0,0,0-5.76L70.94,24a4.08,4.08,0,0,0-5.76,0l-6.76,6.73A2.59,2.59,0,0,1,54.76,27l6.76-6.73a9.27,9.27,0,0,1,13.09,0l4.31,4.33a9.27,9.27,0,0,1,0,13.09L65.39,51.21A9.22,9.22,0,0,1,58.84,53.91Z" transform="translate(-28.21 -17.61)" fill="#fff"/><path d="M41.77,70.93a9.28,9.28,0,0,1-6.55-2.72l-4.31-4.33a9.27,9.27,0,0,1,0-13.09L44.44,37.33a9.26,9.26,0,0,1,13.09,0l2.16,2.16A2.59,2.59,0,1,1,56,43.17L53.86,41a4.07,4.07,0,0,0-5.76,0L34.59,54.46a4.08,4.08,0,0,0,0,5.76l4.32,4.33a4.08,4.08,0,0,0,5.76,0l6.75-6.73a2.59,2.59,0,1,1,3.66,3.67l-6.75,6.73A9.26,9.26,0,0,1,41.77,70.93Z" transform="translate(-28.21 -17.61)" fill="#fff"/></svg>
<p className="logo-text">
URL MINIFY
</p>
</div>
)
}

View File

@ -2,6 +2,7 @@ import React from 'react';
import {Avatar, Box, Button, Container, IconButton, Menu, MenuItem, Toolbar, Tooltip, Typography} from "@mui/material";
import MenuIcon from '@mui/icons-material/Menu';
import NavbarStyle from "./Navbar.style";
import Logo from './Logo';
const pages = ['Products', 'Pricing', 'Blog'];
const settings = ['Profile', 'Account', 'Dashboard', 'Logout'];
@ -28,17 +29,10 @@ function Index(props) {
return (
<NavbarStyle position="fixed">
<Container maxWidth="xl">
<Toolbar disableGutters>
<Typography
variant="h6"
noWrap
component="div"
sx={{ mr: 2, display: { xs: 'none', md: 'flex' } }}
>
LOGO
</Typography>
<Toolbar disableGutters="false">
<Logo/>
<Box sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}>
<IconButton
size="large"
aria-label="account of current user"
@ -74,14 +68,7 @@ function Index(props) {
))}
</Menu>
</Box>
<Typography
variant="h6"
noWrap
component="div"
sx={{ flexGrow: 1, display: { xs: 'flex', md: 'none' } }}
>
LOGO
</Typography>
<Box sx={{ flexGrow: 1, display: { xs: 'none', md: 'flex' } }}>
{pages.map((page) => (
<Button

View File

@ -1,4 +1,5 @@
import '../styles/globals.css'
import '../styles/logostyles.css'
function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -23,3 +23,5 @@ section{
width:100vw;
min-height:100vh;
}

View File

@ -0,0 +1,21 @@
/* This StyleSheet was prepared for the logo in the NavBar.
Please put any other style definitions inside globals.css or create a new stylesheet under styles folder */
.logo{
width: 3rem;
position: relative;
top: 0.2rem;
}
.logo-text{
font-family: sans-serif;
font-weight: 700;
font-size: 2rem;
margin-left: 1rem;
margin-right: 3.5rem;
display: inline-block;
position: relative;
top: -0.7rem;
}

File diff suppressed because it is too large Load Diff