Skip to content

Latest commit

Β 

History

History
40 lines (32 loc) Β· 1.98 KB

File metadata and controls

40 lines (32 loc) Β· 1.98 KB

Project README 🀩

Welcome to my awesome Express.js API project! πŸš€ This project retrieves environment variables for a given project name, all while keeping it secure with a secret authentication token πŸ”’

Getting started 🏁

To get started with the project, you will need to have Node.js and npm installed on your system. You will also need to create a database and set up the necessary environment variables 🌳

  • Clone the project repository to your local machine πŸ–₯️
  • Install dependencies by running npm install πŸ’»
  • Set up the necessary environment variables by creating a .env file in the project root directory 🀫 The following variables are required:
    • DATABASE_URL: the connection string for your database πŸ“
    • AUTH_TOKEN: a static authentication token to be used for API requests πŸ”‘
  • Run the migration scripts to set up the database tables by running npx prisma migrate dev in the terminal πŸ’»
  • Start the server by running npm start πŸš€

API endpoints πŸšͺ

The following API endpoints are available:

GET /env/:projectName

Retrieves the environment variables for the specified project name 🌳

Parameters

projectName (required): the name of the project for which to retrieve environment variables πŸ“

Headers

Authorization: the authentication token, in the format Bearer {AUTH_TOKEN} πŸ”’

Response

  • 200 OK: returns an objec t containing the environment variables for the specified project πŸŽ‰
  • 401 Unauthorized: if the authentication token is missing or invalid 😑
  • 404 Not Found: if no environment variables are found for the specified project 🀷

GET *

Returns a 404 "Not Found" error for all other API requests πŸ€”

Dependencies πŸ“¦

This project uses the following dependencies:

  • express: web framework for Node.js 🌐
  • dotenv: loads environment variables from a .env file πŸ”
  • @prisma/client: ORM for interacting with the database πŸ’Ύ

License πŸ“œ

This project is licensed under the MIT license 🀝 So, you can use it freely! πŸ’ƒ