A sample API implementation supporting CRUD operations for phonebook contacts persisted into SQLite datastore.
Written using TypeScript, Node.js, Express.
- Install dependencies using
npm i
- Populate database with mock data using
npm run populate-db
- Start server with
npm start
- Experiment calling the available endpoints !
npm i
npm test
npm run populate-db
npm start
npm run dev
curl --location --request GET 'http://0.0.0.0:3000/contacts?sortBy=contact_id&order=DESC' \
--data-raw ''
curl --location --request POST 'http://0.0.0.0:3000/contacts' \
--header 'Content-Type: application/json' \
--data-raw '{
"full_name": "koko",
"phone_work": "123",
"phone_mobile": "123",
"phone_other": "123",
"phone_home": "123",
"email": "foo@bar",
"address": "some address"
}'
curl --location --request PUT 'http://0.0.0.0:3000/contacts/2' \
--header 'Content-Type: application/json' \
--data-raw '{
"full_name": "FOO BAARRRRR",
"phone_work": "784-235-0127 x488",
"phone_mobile": "1-214-402-3151 x4870",
"phone_home": "(413) 450-0103",
"phone_other": "611-775-8196 x5190",
"email": "[email protected]",
"address": "359 Jaeden Gateway"
}'
curl --location --request DELETE 'http://0.0.0.0:3000/contacts/151' \
--data-raw ''
- Increase coverage
- Integration tests
- API token access