Skip to content

About

Course assignment – Census application with ExpressJS, MySQL (Aiven) and Render

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

Repository files navigation

Census Application (Server Deployment Assignment)

Project Description

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

Render Live API URL

The deployed application is available here:
https://server-deployment-assignment-rmdr.onrender.com


Running Locally

  1. Clone this repository:

    git clone https://github.com/GordK93/Server-deployment-assignment.git
    cd Server-deployment-assignment
  2. Install dependencies:

    npm install
  3. Create a .env file with the following configuration (see below after Configuration (.env example) ).

  4. Start the server:

    node app.js
  5. The API will be available at:

    http://localhost:3000
    

Configuration (.env example)

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=3000

Authentication

All endpoints are protected with Basic Auth.
Use the following credentials in Postman or curl:

  • Username: admin
  • Password: P4ssword

API Endpoints

Add Participant

POST /participants/add

Get All Participants

GET /participants

Get All Details

GET /participants/details

Get One Personal

GET /participants/details/:email

Get One Work

GET /participants/work/:email

Get One Home

GET /participants/home/:email

Update Participant

PUT /participants/:email

Delete Participant

DELETE /participants/:email


Notes

  • 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-bed1 as required.

About

Course assignment – Census application with ExpressJS, MySQL (Aiven) and Render

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages