Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amio/now-go
Create tinyurl/redirection service with ease.
https://github.com/amio/now-go
micro redirect service tinyurl tinyurl-service
Last synced: about 2 months ago
JSON representation
Create tinyurl/redirection service with ease.
- Host: GitHub
- URL: https://github.com/amio/now-go
- Owner: amio
- License: mit
- Created: 2016-08-26T10:19:15.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-23T20:39:15.000Z (almost 2 years ago)
- Last Synced: 2024-11-09T20:38:46.186Z (2 months ago)
- Topics: micro, redirect, service, tinyurl, tinyurl-service
- Language: JavaScript
- Homepage: https://go.now.sh
- Size: 659 KB
- Stars: 112
- Watchers: 3
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# now-go [![npm-version][npm-badge]][npm-link] [![install-size][pp-badge]][pp-link]
Create tinyurl/redirection service with ease.
Now go, let the legend come back to life!## Features
- Lightweight tinyurl service (~50 sloc).
- Three types of routes:
- __`URL`__: redirect to an url
- __`TEXT`__: echo a string
- __`FUNCTION`__: accepts `req` argument, returns `URL`/`TEXT` routes
- Deploy to now.sh with one command.## Quick Start
- cli
```bash
npm i -g now-go
now-go -c path/to/config.json
```- programmatically
```javascript
const go = require('now-go')
const config = require('./path/to/config.json') // routes configgo(config) // Start server on port 3000
```- create http handler
```javascript
const http = require('http')
const { createHandler } = require('now-go')const config = require('./path/to/config.json')
const handler = createHandler(config)http.createServer(handler).listen(3000)
```## Example configs
### `go-config.json`
```javascript
{
// 302 redirection
"/": "https://example.com",// echo text
"/tag": "Now go, let the legend come back to life!",// "*" is a special route for unmatched path
"*": "Yet another tinyurl service."
}
```### `go-config.js`
```javascript
// redirect everything to new-example.com
module.exports = {
"*": (req) => `https://new-example.com${req.url}`
}
```### Live Demo
- https://go.now.sh and it's [index.js](example/index.js)
## License
[MIT](./LICENSE) © [Amio][author]
[npm-badge]:https://badgen.now.sh/npm/v/now-go
[npm-link]: http://www.npmjs.com/package/now-go
[pp-badge]: https://packagephobia.now.sh/badge?p=now-go
[pp-link]: https://packagephobia.now.sh/result?p=now-go
[mit-link]: http://opensource.org/licenses/MIT
[author]: http://github.com/amio