npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

link-short

v1.5.4

Published

URL Shortener

Downloads

2

Readme

url-shortener

URL Shortener by Melony Smith for Full Sail University: Deployment of Web Applications Online

Purpose

URL Shortener is a NodeJS based RESTful API that allows you to provide a long, cumbersome link to be returned as a convenient six digit URL. The shortened URL will redirect to the page provided by the original link. This is especially useful for sharing links on social media sites that limit the number of characters you are allowed to post.

Installation

Clone or download this repository using the green "Clone or download" button for this repository. The button can be found up and to the right.

Once cloned, install using:

npm install

Start Server

Start the server using:

node src/server.js

If you would like your server to watch for changes and run continuously you can use nodemon.

npm install nodemon

Start the server using:

nodemon src/server.js

Local Host

[https://s29.postimg.org/r6ybuzc1j/localhost01.png]

Endpoints

CRUD for URLs

Method | Path | Result ------------ | ------------- | ------------- POST | /api/v1/urls | Create a shortened URL GET | /api/v1/urls | Display all URLS GET | /api/v1/urls/:id | Displays URL based upon id POST | /api/v1/urls/:id | Update URL based upon id DELETE | /api/v1/urls/:id | Delete url based upon id

Routes

Route | Result ---------- | ------------- /go/:shortURL | Redirect user to original URL based on the short URL

Working with the API

There are various ways to work with the API but I recommend using Postman.

[https://s29.postimg.org/o1dq4rtfb/postman01.png]

[https://s29.postimg.org/yphh3m3ef/postman04.png]

[https://s29.postimg.org/5bqc1rq2f/postman05.png]

dotenv

Installation:

npm install dotenv --save

Create and upload a .env (dotenv) file with the following information:

DB_NAME="your_db_name"
DB_USER="username"
DB_PASS="password"
DB_HOST="000.0.0.0"
DB_SCHEMA=mysql
DB_PORT=“0000”

Include and require .env:

require('dotenv').config()

Usage (Debugging)

Debugging = true (on; messages will appear within the console):

DEBUG=true node src/server.js

Debugging = false (off; messages will not appear within the console but will log to a file):

DEBUG=false node src/server.js

Coding Style Guide

This API follows the coding style guide set by Airbnb.

Unit Tests

You will first need to install mocha. In Terminal run the following command for unit testing:

mocha

Code Coverage

For code coverage, check out istanbul.