Skip to content

Commit

Permalink
chore: use shared dev dependency configs
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud committed Aug 8, 2024
1 parent 6274a36 commit 50149fd
Show file tree
Hide file tree
Showing 85 changed files with 5,568 additions and 5,202 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

20 changes: 0 additions & 20 deletions .eslintrc

This file was deleted.

19 changes: 0 additions & 19 deletions .prettierrc

This file was deleted.

3 changes: 3 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import config from "@eik/eslint-config";

export default config;
29 changes: 13 additions & 16 deletions examples/auth.post.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */

import FormData from 'form-data';
import fetch from 'node-fetch';
import FormData from "form-data";
import fetch from "node-fetch";

const authenticate = async (address) => {
const formData = new FormData();
formData.append('key', 'change_me');
const formData = new FormData();
formData.append("key", "change_me");

const res = await fetch(`${address}/auth/login`, {
method: 'POST',
body: formData,
headers: formData.getHeaders(),
});
const res = await fetch(`${address}/auth/login`, {
method: "POST",
body: formData,
headers: formData.getHeaders(),
});

const body = await res.json();
const body = await res.json();

console.log(body);
}
console.log(body);
};

authenticate('http://localhost:4001');
authenticate("http://localhost:4001");
89 changes: 43 additions & 46 deletions examples/map.alias.delete.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,49 @@
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */

import FormData from 'form-data';
import fetch from 'node-fetch';
import FormData from "form-data";
import fetch from "node-fetch";

const authenticate = async (address) => {
const formData = new FormData();
formData.append('key', 'change_me');
const formData = new FormData();
formData.append("key", "change_me");

const res = await fetch(`${address}/auth/login`, {
method: 'POST',
body: formData,
headers: formData.getHeaders(),
});
const res = await fetch(`${address}/auth/login`, {
method: "POST",
body: formData,
headers: formData.getHeaders(),
});

return res.json();
}
return res.json();
};

const del = async (address) => {
const auth = await authenticate(address);

const headers = {
'Authorization': `Bearer ${auth.token}`
};

const res = await fetch(`${address}/map/buzz/v4`, {
method: 'DELETE',
headers,
})

let result = {};
switch (res.status) {
case 204:
result = { status: res.status, message: 'Deleted' };
break;
case 401:
result = { status: res.status, message: 'Unauthorized' };
break;
case 404:
result = { status: res.status, message: 'Not found' };
break;
case 502:
result = { status: res.status, message: 'Writing file failed' };
break;
default:
result = { status: res.status };
}
console.log(result);
}

del('http://localhost:4001');
const auth = await authenticate(address);

const headers = {
Authorization: `Bearer ${auth.token}`,
};

const res = await fetch(`${address}/map/buzz/v4`, {
method: "DELETE",
headers,
});

let result = {};
switch (res.status) {
case 204:
result = { status: res.status, message: "Deleted" };
break;
case 401:
result = { status: res.status, message: "Unauthorized" };
break;
case 404:
result = { status: res.status, message: "Not found" };
break;
case 502:
result = { status: res.status, message: "Writing file failed" };
break;
default:
result = { status: res.status };
}
console.log(result);
};

del("http://localhost:4001");
13 changes: 5 additions & 8 deletions examples/map.alias.get.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */
import fetch from "node-fetch";

import fetch from 'node-fetch';

fetch('http://localhost:4001/map/buzz/v4', {
method: 'GET',
fetch("http://localhost:4001/map/buzz/v4", {
method: "GET",
})
.then(res => res.json())
.then(json => console.log(json));
.then((res) => res.json())
.then((json) => console.log(json));
96 changes: 48 additions & 48 deletions examples/map.alias.post.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */

import FormData from 'form-data';
import fetch from 'node-fetch';
import FormData from "form-data";
import fetch from "node-fetch";

const authenticate = async (address) => {
const formData = new FormData();
formData.append('key', 'change_me');
const formData = new FormData();
formData.append("key", "change_me");

const res = await fetch(`${address}/auth/login`, {
method: 'POST',
body: formData,
headers: formData.getHeaders(),
});
const res = await fetch(`${address}/auth/login`, {
method: "POST",
body: formData,
headers: formData.getHeaders(),
});

return res.json();
}
return res.json();
};

const post = async (address) => {
const auth = await authenticate(address);

const formData = new FormData();
formData.append('version', '4.4.2');

const headers = {'Authorization': `Bearer ${auth.token}`, ...formData.getHeaders()};

const res = await fetch(`${address}/map/buzz/v4`, {
method: 'POST',
body: formData,
headers,
})

let result = {};
switch (res.status) {
case 200:
result = await res.json();
break;
case 401:
result = { status: res.status, message: 'Unauthorized' };
break;
case 404:
result = { status: res.status, message: 'Not found' };
break;
case 502:
result = { status: res.status, message: 'Writing file failed' };
break;
default:
result = { status: res.status };
}
console.log(result);
}

post('http://localhost:4001');
const auth = await authenticate(address);

const formData = new FormData();
formData.append("version", "4.4.2");

const headers = {
Authorization: `Bearer ${auth.token}`,
...formData.getHeaders(),
};

const res = await fetch(`${address}/map/buzz/v4`, {
method: "POST",
body: formData,
headers,
});

let result = {};
switch (res.status) {
case 200:
result = await res.json();
break;
case 401:
result = { status: res.status, message: "Unauthorized" };
break;
case 404:
result = { status: res.status, message: "Not found" };
break;
case 502:
result = { status: res.status, message: "Writing file failed" };
break;
default:
result = { status: res.status };
}
console.log(result);
};

post("http://localhost:4001");
Loading

0 comments on commit 50149fd

Please sign in to comment.