An open API service indexing awesome lists of open source software.

https://github.com/timxor/nodejs-typescript-api-server

nodejs-typescript-api-server
https://github.com/timxor/nodejs-typescript-api-server

Last synced: 4 months ago
JSON representation

nodejs-typescript-api-server

Awesome Lists containing this project

README

        

# nodejs-typescript-api-server

nodejs-typescript-api-server

# Quick Start

# Installation and Start Server

```
npm install
brew install jq
npm run start
```

# Test endpoint is running

```
curl http://localhost:3000/
```

# Create a New Book (POST)

```
curl -X POST http://localhost:3000/books \
-H "Content-Type: application/json" \
-d '{"title": "The Hobbit", "author": "J.R.R. Tolkien"}'
```

# Read All Books (GET)

```
curl http://localhost:3000/books | jq
```

# Read a Single Book (GET)

```
curl http://localhost:3000/books/1 | jq
```

# Update a Book (PUT)

```
curl -X PUT http://localhost:3000/books/1 \
-H "Content-Type: application/json" \
-d '{"title": "The Hobbit", "author": "J.R.R. Tolkien Updated"}'
```

# Delete a Book (DELETE)

```
curl -X DELETE http://localhost:3000/books/1
```