GithubHelp home page GithubHelp logo

muhsin-k / url-shortner Goto Github PK

View Code? Open in Web Editor NEW
136.0 11.0 47.0 1.3 MB

Creating custom URL shortener using Nodejs

JavaScript 89.49% HTML 4.52% CSS 5.99%
nodejs mongodb express rest-api mongoose nginx shortid valid-url react react-router

url-shortner's Introduction

URL-Shortner

Creating custom URL shortener With Nodejs

Built with ❤︎

Building a custom URL shortening service like goo.gl using ExpressJs and Mongodb

Architecture

architecture

Technologies

  • Back end

    • Express- Nodejs framwork for building the REST Apis
    • Mongodb- Document oriented NoSQL database
    • Mongoose- MongoDB object modeling tool
    • Short-id- Short id generator
    • Valid-url- URI validation functions
    • Nginx- Nginx is event-based and asynchronous web server.
  • Front end

    • React - JavaScript library for building user interfaces.
    • React-router- Complete routing library for React
    • Materialize css- Responsive front-end framework based on Material Design

Getting Started

Clone the project

# clone it
git clone https://github.com/muhzi4u/URL-Shortner.git
cd URL-Shortner
# Make it your own
rm -rf .git && git init

Run back end

# Move to server folder
cd server/
# Install dependencies
yarn install

# Start  server
yarn run server

Run front end

# Move to client folder
cd client/
# Install dependencies
yarn install
# Start  client
yarn run start

Demo

NSGIF

Blog

Creating custom URL shortener with Nodejs

☑ TODO

  • Front end app
  • Documentation and Blog
  • Add Redis for caching
  • Change short code algorithm and check duplicate short codes

License

MIT

url-shortner's People

Contributors

muhsin-k avatar tuhuynhvan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

url-shortner's Issues

NGINX not redirecting

Hi I'm trying to do the final step, which is the redirecting.

I've done the NGINX configuration:

server {
listen 8080 default_server;
listen [::]:8080 default_server;
server_name localhost;
#charset koi8-r;

    #access_log  logs/host.access.log  main;

   location / {
        root   html;
        index  index.html index.htm;
    }
    location ~* "^/[0-9a-z@]{5,15}$"  {
            rewrite ^/(.*)$ http://localhost:7000/api/item/$1 redirect;
    }

But the error I get in the browser is :
This site can’t be reached localhost refused to connect.

On Postman it's :

Could not get any response
There was an error connecting to http://localhost/kRKAtUi3r.

Any ideas what's wrong?

Redirecting

I was wondering why app.get('/api/item/:code') is present and why not app.get('/:code') to get the param from the url.

inquiry

Hi, nice project you got going here, will want to use it but any chance you'll add more code to the project especially those from your todo:

  • Add Redis for caching
  • Change short code algorithm and check duplicate short codes

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.