/express-api

Rest API developed with Express

Primary LanguageJavaScriptMIT LicenseMIT

express-api

Basic Rest API developed with Express

Steps

Clone repository

git clone https://github.com/reisbel/express-api.git && cd express-api

Install npm packages

npm install

Run the application

npm start

Explore the API

Authenticate

curl --location --request POST 'http://localhost:8080/login' \
--data-urlencode 'email=dummy-user@gmail.com' \
--data-urlencode 'password=123'

The token generated and returned as part of the login will be used for other operations.

Get task list

curl --location --request GET 'http://localhost:8080/todo' \
--header 'token: {{token}}'

Create a task

curl --location --request POST 'http://localhost:8080/todo' \
--header 'token: {{token}}' \
--data-urlencode 'name=3rd dummy task' \
--data-urlencode 'completed=false'

Update a task

curl --location --request PUT 'http://localhost:8080/todo/1' \
--header 'token: {{token}}' \
--data-urlencode 'name=updated dummy task' \
--data-urlencode 'completed=true'

Delete a task

curl --location --request DELETE 'http://localhost:8080/todo/1' \
--header 'token: {{token}}'

References

License

MIT - See LICENSE for more information.