This API is here to help you manage all your contacts in a breeze.
This API documentation is meant for educational purposes to demonstrate friendly and approachable technical writing.
Just run npm install
and all the dependencies will be ready to roll! ๐
Copy .env.example
to .env
and personalize it with your DB info.
cp .env.example .env
Come on, I know you'll get it right!
APP_NAME=PhoneBook API
APP_SCHEMA=http
APP_HOST=localhost
APP_PORT=8000
APP_ROUTE_PREFIX=/api
DB_TYPE=mysql
DB_HOST=localhost
DB_PORT=3306
DB_USERNAME=
DB_PASSWORD=
DB_DATABASE=phonebook
DB_SYNCHRONIZE=
DB_LOGGING=true
LOGGING_OUTPUT=dev
Just run npm run db:migrate
and voila, your tables will be ready for some contact action! ๐ฆ
Run npm run build
to prep the backend ๐ช
Then node dist/src/index.js
to start the party! ๐
Check out your contacts at http://localhost/api/contacts
๐
Or try out the routes below with Insomnia, Postman or curl. ๐ค
A Postman collection with requests is included in the source code for testing the API.
- GET - Get all contacts ๐
- POST - Add a new contact โ
- GET /:id - Get contact by ID ๐
- PUT /:id - Update my contact โ๏ธ
- DELETE /:id - Remove contact โ
You can build a Docker image and run a container as follows:
docker build -t phonebookapi-image .
docker run -p 8000:8000 --name phonebook-api --env-file .env phonebookapi-image
- Express (for some fast backends) ๐
- TypeORM (ORM) ๐ค
- MySQL (for storage) ๐พ
- Node.js ( obviously!) ๐
- TypeScript (for type safety) ๐ฆ
This API is ready to handle all your contact ๐ needs! Let me know if you have any other questions. ๐ค Happy dialing! ๐