// GET /api/elements
const ajio = require("ajio")
ajio.baseUrl("https://apis-periodic-table.herokuapp.com/")
ajio
.get("/api/elements")
.then((elements) => console.log(elements))
.catch((err) => console.log(err))
npm install ajiojs
Method | Route | description |
---|---|---|
/Get | /api/elements | gets all the elements |
/Get | /api/elements/name | gets an element by the name |
/Get | /api/elements/symbol | gets an element by the symbol |
Use conventional queries like sort and limit
sort | limit |
---|---|
default: asc | default: null |
note: asc is ascending order, desc is descending order
const ajio = require("ajio")
ajio.get("/api/elements?sort=desc&limit=5").then((elements) => {
console.log(elements)
})
// this returns the last 5 elements
var ajio = require("ajio")
ajio
.post("/api/elements/create", {
body: JSON.stringify(`{
"atomicNumber": 1,
"symbol": "H",
"name": "Hydrogen",
"atomicMass": "1.00794(4)",
"cpkHexColor": "FFFFFF",
"electronicConfiguration": "1s1",
"electronegativity": 2.2,
"atomicRadius": 37,
"ionRadius": "",
"vanDelWaalsRadius": 120,
"ionizationEnergy": 1312,
"electronAffinity": -73,
"oxidationStates": "-1, 1",
"standardState": "gas",
"bondingType": "diatomic",
"meltingPoint": 14,
"boilingPoint": 20,
"density": 0.0000899,
"groupBlock": "nonmetal",
"yearDiscovered": 1766
}`),
})
.then((res) => {
if (res.status == 200) console.log(data)
})
.catch((e) => {
console.log(e)
})