https://github.com/sudo-self/whois-who
https://github.com/sudo-self/whois-who
Last synced: 24 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sudo-self/whois-who
- Owner: sudo-self
- Created: 2024-11-15T19:47:21.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-16T06:48:27.000Z (over 1 year ago)
- Last Synced: 2025-01-24T14:45:51.476Z (over 1 year ago)
- Language: Svelte
- Homepage: https://whois-who.vercel.app
- Size: 166 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Whois Who Domain Lookup
1. create a new svelte project
```
npx degit sveltejs/template svelte-whois
cd svelte-whois
npm install
```
#### API KEY
```
https://whois.whoisxmlapi.com
```
#### App.svelte
(modify the default App.svelte to import WhoisLookup.svelte)
```
import WhoisLookup from './WhoisLookup.svelte';
```
2. add it in the main component
```
```
#### src/WhoisLookup.svelte
```
import { onMount } from "svelte";
let domain = "";
let whoisData = null;
let loading = false;
let error = null;
const fetchWhoisData = async () => {
if (!domain) {
error = 'Please enter a domain';
return;
}
loading = true;
error = null;
try {
const apiKey = "xxxxxxxxxxx";
const response = await fetch(
`https://www.whoisxmlapi.com/whoisserver/WhoisService?apiKey=${apiKey}&domainName=${domain}&outputFormat=JSON`
);
if (!response.ok) {
throw new Error('Failed to fetch WHOIS data');
}
const data = await response.json();
whoisData = data;
} catch (err) {
error = err.message || 'An error occurred';
whoisData = null;
} finally {
loading = false;
}
};
```
#### dev server
```
npm run dev
```
WhoisWho.png
https://whois-who.vercel.app
SVELTE!