deomorxsy / cardapi002rhr

[ON-HOLD] (82%) simple crud API with typescript and nodejs.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CARDAPI002

Node

Clone project

git clone git@github.com:deomorxsy/cardapi002.git

change to server directory

cd ./cardapi002/server/

Install the following packages and type definitions:

npm i -D typescript
npm i -D @types/node @types/express @types/dotenv @types/cors @types/helmet
npm i -D ts-node-dev

run with:

npm run dev

PS: remember it reads the PORT from the .env dotfile, so if it seems stuck, check that file

OCI Container

still with node but containerized

Build container image from local Containerfile. Add a tag with the 't' flag.

# docker
docker build -t your-app-name .

# podman
podman build -t your-app-name -f ./{Dockerfile.framework-you-want}

# buildah
buildah bud -t your-app-name -f ./{Dockerfile.framework-you-want}

Run process and expose the port:

docker run --rm -p 3000:3000 your-app-name
# or
podman run --rm -p 3000:3000 your-app-name

PS: with podman, use podman-stop to fully stop the process instead of just sending SIGINT with ctrl+c. In this case, just get the PID with podman-ps and pass it as argument.

you can test POST and other http verbs/methods using curl. Replace the port accordingly.

curl -X POST -H 'Content-Type: application/json' -d '{
  "name": "Salad",
  "price": 499,
  "description": "Fresh",
  "image": "your-image-uri-link"
}' http://localhost:3000/api/menu/items -i

About

[ON-HOLD] (82%) simple crud API with typescript and nodejs.

License:GNU General Public License v3.0


Languages

Language:JavaScript 56.3%Language:TypeScript 35.3%Language:Vue 3.2%Language:Dockerfile 3.2%Language:HTML 1.9%