This is my submission for task 2 of the HNG internship program
- Node.js
- TypeScript
- express
- Postgresql
Person
- id
- name
- created_at
Response
- status:
boolean
-> always present (false
on error,true
on success) - message:
string
-> not always present - data:
object
,array
-> not always present
- get all persons: GET (
/api
) - get specific person: GET (
/api/{id}
) - create person: POST (
/api
) - update person: PATCH (
/api/{id}
) - delete person: DELETE (
/api/{id}
)
To use this server, follow the instructions below:
-
Fork this repository, and create a
.env
file in the destination folder. -
In your newly created
.env
file, fill in the necessary information.- POSTGRES_USER: The username of your postgres user
- POSTGRES_PASS: The password for your postgres user
- POSTGRES_HOST: The postgres database host
- POSTGRES_DB: The name of your postgres database
- POSTGRES_PORT: The port your postgres database is running on
-
With node installed, run
npm i
to install all required dependencies -
With all dependencies installed, run
npm start
to start the server.
- Use https://aizonhngtasks.azurewebsites.net/api to make a sample API request on the HNG submitted task
- Use http://localhost:8080 to make API requests on your locally hosted server.
- The server runs on port 8080 by default but you can change that by adding a
PORT
field in the env file and specifying your preferred port number