https://github.com/blackglory/uid
🌳 Web-friendly microservice for generating unpredictable UIDs.
https://github.com/blackglory/uid
docker-image esm microservice nodejs typescript
Last synced: about 1 year ago
JSON representation
🌳 Web-friendly microservice for generating unpredictable UIDs.
- Host: GitHub
- URL: https://github.com/blackglory/uid
- Owner: BlackGlory
- License: mit
- Created: 2020-10-18T05:40:56.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-24T12:27:49.000Z (over 1 year ago)
- Last Synced: 2025-01-01T17:18:04.487Z (about 1 year ago)
- Topics: docker-image, esm, microservice, nodejs, typescript
- Language: TypeScript
- Homepage: https://hub.docker.com/r/blackglory/uid
- Size: 1.22 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# UID
An UUID generator with HTTP.
## Install
### Install from source
```sh
git clone https://github.com/BlackGlory/uid
cd uid
yarn install
yarn build
yarn bundle
yarn --silent start
```
### Build from source
```sh
git clone https://github.com/BlackGlory/uid
cd uid
yarn install
yarn build
yarn docker:build
```
### Recipes
#### docker-compose.yml
```yaml
version: '3.8'
services:
uid:
image: 'blackglory/uid'
restart: always
ports:
- '8080:8080'
```
## API
### generate Nano ID
`GET /nanoid`
Return a Nano ID as a text.
#### Example
##### curl
```sh
curl http://localhost:8080/nanoid
```
##### JavaScript
```js
await fetch('http://localhost:8080/nanoid')
.then(res => res.text())
```
### generate UUID
`GET /uuid`
Return a uuid as a text.
#### Example
##### curl
```sh
curl http://localhost:8080/uuid
```
##### JavaScript
```js
await fetch('http://localhost:8080/uuid')
.then(res => res.text())
```
## Environment variables
### `UID_HOST`, `UID_PORT`
The environment variables`UID_HOST`and`UID_PORT`can be used to set the address and port
that the server listens to.
The default values are `localhost` and `8080`.
## Clients
- JavaScript/TypeScript(Node.js, Browser):