Skip to content

YozhikM/tiny-url-mongoose-express

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyUrl-mongoose-express

install size Greenkeeper badge FlowType compatible

This is a simple shortening link, based on Mongoose and Express

Requirements

API

tinyUrlRouter()

tinyUrlRouter(): Router;

TinyUrl

TinyUrl: MongooseModel;

TinyUrlSchema

TinyUrlSchema: MongooseSchema;

{
  _id: number; // start at 100
  url: string; // canonical URL
  createdAt: ?Date; // created automatically
  encodedId: string;
}

How to use

Step 1

yarn add tiny-url-mongoose-express

Step 2

In the schema folder, you need to connect your database. Then connect the router to your Express routing.

// schema
import { TinyUrl } from 'tiny-url-mongoose-express'
// server

import { tinyUrlRouter } from 'tiny-url-mongoose-express';
//
const router = expess.Router();
router.use('/u', tinyUrlRouter());
//

Step 3

Create records in Mongo and use!

TinyUrl.create({ url: 'example.com/hello' });

About

Simple tool for shortening link, based on Mongoose and Express

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published