Added start and bin script

This commit is contained in:
Joonas 2022-11-08 16:47:18 +02:00
parent 07877a0da9
commit 950b2ad97c
3 changed files with 13 additions and 6 deletions

4
index.mjs Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
import fetch from "node-fetch"; import fetch from "node-fetch";
const APIURI = "https://fi.jamix.cloud/apps/menuservice/rest/haku/menu/92225/1?lang=fi" const APIURI = "https://fi.jamix.cloud/apps/menuservice/rest/haku/menu/92225/1?lang=fi"
var todayDate = new Date().toISOString().slice(0, 10).replaceAll('-', ''); var todayDate = new Date().toISOString().slice(0, 10).replaceAll('-', '');
@ -20,4 +22,4 @@ function getFood(data) {
fetch(APIURI) fetch(APIURI)
.then((response) => response.json()) .then((response) => response.json())
.then((data) => getFood(data).map((food) => console.log(food))); .then((data) => getFood(data).map((food) => console.log(food)));

7
package-lock.json generated
View File

@ -1,15 +1,18 @@
{ {
"name": "faicli", "name": "faifood",
"version": "1.0.0", "version": "1.0.0",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "faicli", "name": "faifood",
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"node-fetch": "^3.2.10" "node-fetch": "^3.2.10"
},
"bin": {
"faifood": "index.mjs"
} }
}, },
"node_modules/data-uri-to-buffer": { "node_modules/data-uri-to-buffer": {

View File

@ -1,12 +1,14 @@
{ {
"name": "faicli", "name": "faifood",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "start": "node index.mjs"
"run": "node index.js"
}, },
"bin": {
"faifood": "index.mjs"
},
"keywords": [], "keywords": [],
"author": "", "author": "",
"license": "ISC", "license": "ISC",