├── .gitignore
├── config.json
├── views
├── save.ejs
├── exist.ejs
├── redirect.ejs
└── index.ejs
├── models
└── redirect.js
├── README.md
├── mongoose.js
├── package.json
└── index.js
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | env.json
3 | *.exe
4 | dist/
--------------------------------------------------------------------------------
/config.json:
--------------------------------------------------------------------------------
1 | {"rickroll":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","dc":"https://discord.com"}
--------------------------------------------------------------------------------
/views/save.ejs:
--------------------------------------------------------------------------------
1 | Your extension <%= extension %> have been saved for the url <%= url %>
--------------------------------------------------------------------------------
/views/exist.ejs:
--------------------------------------------------------------------------------
1 | That extension <%= extension %> already exists, try making a newer one.
--------------------------------------------------------------------------------
/models/redirect.js:
--------------------------------------------------------------------------------
1 | const { Schema, model } = require('mongoose');
2 |
3 | const Sc = new Schema({
4 | Extension: String,
5 | Url: String
6 | })
7 |
8 | module.exports = model("redirectmodel", Sc)
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Visit [here](https://url.nandhu.me) to see this app in action.
2 | > I currently used config.json for storage as i will implement mongoose later.
3 | > Remove the lines which require mongoose and any mongo schemas to prevent errors if not connected.
4 |
--------------------------------------------------------------------------------
/mongoose.js:
--------------------------------------------------------------------------------
1 | const mongoose = require('mongoose');
2 |
3 | mongoose.connect(`${process.env.mongostring}`, {
4 | useNewUrlParser: true,
5 | useUnifiedTopology: true,
6 | }).then(() => {
7 | console.log('Connected to MongoDB 💚');
8 | }).catch(err => {
9 | console.log('Error ➡', err.message);
10 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tinyurls",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node index.js",
8 | "win-build": "pkg -t node16-win index.js -o dist/win",
9 | "mac-build": "pkg -t node16-macos index.js -o dist/mac",
10 | "linux-build": "pkg -t node16-linux index.js -o dist/linux",
11 | "test": "nodemon idnex.js -e js,ejs,json,html,css"
12 | },
13 | "keywords": [],
14 | "author": "",
15 | "license": "ISC",
16 | "dependencies": {
17 | "body-parser": "^1.20.0",
18 | "ejs": "^3.1.7",
19 | "express": "^4.17.3",
20 | "mongoose": "^6.3.0"
21 | }
22 | }
--------------------------------------------------------------------------------
/views/redirect.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |