This project is inspired by a course on Nodejs i took by Pirple
This uses in built node modules that are shipped with node to create a website tracker reastful api from srcatch.
- Create, Read, Update and Delete Users
- Token Based Authentication
- Background workers to check website status and alert user on status change
- File based database
- Custom templating engine
- Application logging
-
Clone repository and cd into folder
git clone https:github.com/michealnaita/node-by-pirple api && cd ./api
-
Add data and logs folders
mkdir -p ./.data/checks ./.data/tokens ./.data/users ./.logs/checks ./.logs/errors
-
set enviromental variables for application In your terminal
ACCOUNT_SID=[your-twilio-account-sid] AUTH_TOKEN=[your-twilio-auth-token] HTTP_PORT=[prefered-http-port-number] HTTPS_PORT=[prefered-https-port-number] NODE_ENV=development
-
make sure that node is installed on your system
node --version
or folow installation guide
-
Run application
node index.js
-
Test using Postman
Note: All routes are protected therefore you need to create account get token, then set token in header under the key: token
-
/api/users
- allowed methods: GET, POST, PUT, DELETE
-
/api/checks
- allowed methods: GET, POST, PUT, DELETE
-
/api/tokens
- allowed methods: GET, POST, PUT, DELETE
-
/ping
- allowed methods: GET