EverydayTech Platform - Developer Reference
Complete Source Code Documentation - All Applications
Loading...
Searching...
No Matches
test_register.js
Go to the documentation of this file.
1// Test domain registration with Moniker API
2require('dotenv').config({ path: require('path').resolve(__dirname, '../.env') });
3const moniker = require('../services/moniker');
4
5/**
6 *
7 */
8async function testRegistration() {
9 console.log('🧪 Testing Moniker Domain Registration\n');
10
11 try {
12 const testDomain = 'testdomain' + Date.now() + '.com';
13 console.log(`Attempting to register: ${testDomain}`);
14
15 const result = await moniker.registerDomain({
16 domain: testDomain,
17 years: 1,
18 nameservers: ['ns1.digitalocean.com', 'ns2.digitalocean.com'],
19 ownercontact: {
20 FirstName: 'John',
21 LastName: 'Smith',
22 Organization: 'Test Company',
23 Email: 'test@example.com',
24 Phone: '+1.5551234567',
25 Address: '123 Test St',
26 City: 'New York',
27 State: 'NY',
28 PostalCode: '10001',
29 Country: 'US'
30 }
31 });
32
33 console.log('\n✅ Registration result:', JSON.stringify(result, null, 2));
34
35 } catch (error) {
36 console.error('\n❌ Registration failed:', error.message);
37 if (error.response) {
38 console.error('Response data:', error.response.data);
39 }
40 }
41}
42
43testRegistration();