RestSv
Links
Zielsetzung
ResetSv ist ein Web-Server, der mittels HTTP-Protokoll das REST-Designpattern implementiert. Programmiersprache ist TypeScript.
Installation
BASE=/home/ws/ts/rest_sv sudo apt install node-npm sudo npm install -g typescript mkdir -p $BASE && cd $BASE # Folgendes Kommando fragt Daten ab: npm init # package name (rest_sv): # version: (1.0.0) # description: A REST web server. # entry point: (index.js) # test command: # git repository: # keywords: # author: Hamatoma # license: (ISC) CC0 1.0 Universal npm install typescript ts-node express @types/express morgan @types/morgan \ axios @types/axios nodemon tsc --init
- Modifiziere package.json:
"main": "source/server.ts", "scripts": { "dev": "nodemon source/server.ts", "build": "rm -rf build/ && prettier --write source/ && tsc" }
- Quelldateien erzeugen:
mkdir -p source/controllers source/routes touch source/server.ts source/controllers/services.ts source/routes/services.ts
Service starten
npm run dev