This is a Census API built with ExpressJS and deployed on Render.com.
It uses MySQL hosted on Aiven.io for persistent storage.
The application allows an authenticated admin user to manage participants’ data (CRUD operations).
All endpoints require Basic Auth with the following credentials:
- Username:
admin - Password:
P4ssword
The deployed application is available here:
https://server-deployment-assignment-rmdr.onrender.com
-
Clone this repository:
git clone https://github.com/GordK93/Server-deployment-assignment.git cd Server-deployment-assignment -
Install dependencies:
npm install
-
Create a
.envfile with the following configuration (see below after Configuration (.env example) ). -
Start the server:
node app.js
-
The API will be available at:
http://localhost:3000
This is an example of the required environment variables.
Your actual values will be provided by Aiven.io.
DB_HOST=mysql-xxxxx-server-deployment.l.aivencloud.com
DB_PORT=22821
DB_USER=avnadmin
DB_PASSWORD=your_aiven_password
DB_NAME=defaultdb
PORT=3000All endpoints are protected with Basic Auth.
Use the following credentials in Postman or curl:
- Username:
admin - Password:
P4ssword
POST /participants/add
GET /participants
GET /participants/details
GET /participants/details/:email
GET /participants/work/:email
GET /participants/home/:email
PUT /participants/:email
DELETE /participants/:email
- All requests must include Basic Auth.
- If invalid data is sent, a descriptive error message is returned as JSON.
- This repository is set to private and shared with
noroff-bed1as required.