Giter Site home page Giter Site logo

shortener's Introduction

:octocat: urlShortener (visit)

made with mongodb made with express made with hbs last-commit code-size

Yet another shortener !

Full stack Url Shortner with tech stack :
(M)ongo
(E)xpress
(N)ode
 + now

Peek a boo!

progress

User Guide

    1. visit https://little.now.sh
    2. create a shorten-URL
    3. visit https://little.now.sh/s/{nameUProvided}
    4. Simple!

Developer Guide

    npm run dev
    visit localhost:8081 to test the app

API EndPoints

Http Method Endpoint
POST /api/shortit
GET /s/:shortName
GET /
GET /(*)
/api/shortit (POST)
{
    url: "https://www.google.com",
    name: "go"
}
/s/:shortname (GET)
redirect(url);
/ (GET)
render("index.hbs");
/(*) (GET)
redirect("/");

Followed Steps

- npm init
- npm install express( Fast, unopinionated, minimalist web framework for node).
- npm install morgan(HTTP request logger middleware for node.js)
- npm install mongodb(for Non-relational DB)
- Building an Express App
- serving a html page from public folder for form inputs
    - long URL
    - shortname
- calling backend to take the form-data , validating data, returning data/error
- adding mongo as db  and mongodb as driver and while deploying used mongodb.com for data storage
- setting connection for Database
- made an api for serving data inside mapped_urls.js
- make a connection to db
- use collection to figure out if mapping exist or not
    - if exist throw error
    - else add a new entry to database

Database Creation for testing

$ use dbname
    create a db in mongodb
$ db.createCollection('mapped_urls')
    created a collection, Output : { "ok" : 1 }

Deployment with Zeit's now

1. Add a now.json File (Phew! that was more work!!)
2. now secrets add <secret-name> <secret-value>
3. $ now -e MONGODB_URL=@mysql-secret
4. now alias ___ little.now.sh

shortener's People

Contributors

jugshaurya avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

shortener's Issues

changes required to be done

1- Includedd bootstrap but now use bootswatch , the theme palletes for bootstrap , so that site becomes responsive, not looking googd on mobile

2 - Show error and generted link in their respective divs not in same

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.