GithubHelp home page GithubHelp logo

padamupreti / url-shortener Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 80 KB

A simple URL shortener built with express

License: BSD 3-Clause "New" or "Revised" License

JavaScript 43.76% CSS 35.01% Handlebars 21.22%
expressjs sequelize-orm javascript postgresql sqlite3

url-shortener's Introduction

url-shortener

A simple url shortener.

Screenshot

Requirements

Setup

To install dependencies, navigate to project root in the terminal and run:

npm i

After installation of dependencies, proceed with one of two options given below:

Option 1 (Sqlite)

To quickly try the application, it may be run with a sqlite3 instance.
To do this, make the following changes in config/database.js

const sequelize = new Sequelize('database', null, null, {
    dialect: 'sqlite',
    storage: 'database.sqlite',
    logging: false,
})

Then, to start the app locally:

npm start

With this option, a database.sqlite is created at project root.

Option 2 (PostgreSQL)

For practical usage, a PostgreSQL database is preferred over sqlite. For this option, no modification of config/database.js is needed. Dependencies for PostgreSQL support should have installed during the setup step.

The credentials for database connection are to be stored in a .env file created at the root of the project in the following format:

DB_USERNAME=<postgres-db-username-here>
DB_PASSWORD=<postgres-db-password-here>
DB_HOST=<postgres-db-host-here>
DB_PORT=<postgres-db-port-here>
DB_NAME=<postgres-db-name-here>

Then, to start the app locally:

npm start

Other options

As this project uses Sequelize ORM, other databases supported by it can be used. This approach requires changing some dependencies and possible additonal configurations. For more information, visit Sequelize ORM Documentation.

url-shortener's People

Contributors

padamupreti avatar

Watchers

 avatar

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.