This repository contains the API of my snippets service project. The client side can be found here.
git clone https://github.com/hecht-a/bin-service-api
cd bin-service-api
yarn
node ace migration:run
yarn dev
npm install
node ace migration:run
npm run dev
yarn build
cp .env build/.env
cd build/
yarn
node ace migration:run
yarn start
GET /health
: Get health of the api
POST /snippet
: Save new snippet
curl -X POST http://localhost:3333/snippet -H "Content-Type: application/x-www-form-urlencoded" -d "code=console.log('snippet saved');&lang=ts"
{
"id":"YWNOHD",
"ext":"ts"
}
GET /snippet/:id
: Get snippet by its id
curl -X GET http://localhost:3333/snippet/YWNOHD
{
"code":
{
"id":29,
"code":"console.log('snippet saved');",
"snippet_id":"YWNOHD",
"created_at":"2021-09-13T00:48:05.000+02:00",
"updated_at":"2021-09-13T00:48:05.000+02:00"
},
"length":1
}