Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/renantrs/url-shortener-dio

Projeto desafio Encurtador de links - DIO
https://github.com/renantrs/url-shortener-dio

express mongodb nodejs typescript

Last synced: about 1 month ago
JSON representation

Projeto desafio Encurtador de links - DIO

Awesome Lists containing this project

README

        


Logo bootcamp spread

URL Shortener


This project is my fourth bootcamp spread challenge.


GitHub License
GitHub top language
GitHub last commit
GitHub issues open
GitHub closed issues
GitHub pull request open
GitHub closed pull requests

## How to use

To clone and run this project, you'll need **[Git](https://git-scm.com)**, **[node v14.20.0](https://nodejs.org/en/)** or higher + **[yarn v1.22.15](https://yarnpkg.com)** or higher installed on your computer. From your command line:

```bash
#Clone this repository
$ git clone https://github.com/RenanTRS/url-shortener-dio

#Go into the repository
$ cd url-shortener-dio

#Install dependencies
$ yarn
#or
$ npm i

#Run
$ yarn dev
#or
$ npm run dev

#Build
$ yarn build
#or
$ npm run build

#Run build
$ yarn start
#or
$ npm run start
```

## .ENV

```
BASE_URL: your_baseurl_here
MONGO_URI: your_stringconnection_database_here
```

## Routes:

**POST:**
`http:///shorten`

Request (body):

```json
{
"originURL": "https://www.npmjs.com"
}
```

Response:

```json
{
"_id": "62ca10afd21ae74c7ff28cc0",
"hash": "GkSYmaFoU",
"originURL": "https://www.npmjs.com",
"shortURL": "http://localhost:3333/GkSYmaFoU",
"__v": 0
}
```

**GET:**
`http:///hash-generated` - _(shortURL)_

## Built with

- [NodeJs](https://nodejs.org/en/)
- [TypeScript](https://www.typescriptlang.org/)
- [Express](http://expressjs.com/)
- [ts-node-dev](https://www.npmjs.com/package/ts-node-dev)
- [Babel](https://babeljs.io/)
- [MongoDb](https://www.mongodb.com/)
- [Mongoose](https://mongoosejs.com/)
- [ShortId](https://www.npmjs.com/package/shortid)
- [DotEnv](https://www.npmjs.com/package/dotenv)
- [EsLint](https://eslint.org/)
- [Prettier](https://prettier.io/)

## Contact

- Email me - [email protected]
- Connect with me on [LinkedIn](https://www.linkedin.com/in/renantrsouza/)

## License

This project is licensed under the MIT License - see the [LICENSE](https://github.com/renantrs/url-shortener-dio/blob/main/LICENSE) file for details.