create and cd into app folder
~ $ mkdir myapp && cd app
create new solution file. If no name is specified file is automatically named after the parent folder
~/app $ dotnet new sln
create a project called api from webapi template
~/app $ dotnet new webapi -n api
add api project to solution file
~/app $ dotnet sln add api/api.csproj
create a project called lib from classlib template
~/app $ dotnet new classlib -n lib
add lib project to solution file
~/app $ dotnet sln add lib/lib.csproj
reference lib project inside api project
~/app $ dotnet add api/api.csproj reference lib/lib.csproj
add nuget package to api project
~/app $ dotnet add api/api.csproj package Swashbuckle.AspNetCore
using cURL
$ curl -v -X POST -H 'Content-Type: application/json' -d '{"name":"john doe"}' http://localhost:5000/api/whatevs