Skip to content

API Server running with Node, Express, Yarn, and Morgan.

License

Notifications You must be signed in to change notification settings

shrunSprint89/shrunSprint89ApiServer

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploy on Railway

OpenAI Express Server

This is an express RESTful API project, using Node.js and Express, written in JavaScript.

Includes

Server utilites:

  • morgan- HTTP request logger middleware for Node.js
  • dotenv- Loads environment variables from .env file into process.env
  • cors- CORS provides a Connect/Express middleware that can be used to enable CORS with various options.
  • openai- This library provides convenient access to the OpenAI REST API from TypeScript or JavaScript.

Development utilites

  • nodemon- Helps develop node.js based application by automatically restarting the node server when it detects application file changes.

Commands

Setup

yarn

Development

yarn dev

About

The server runs a simple Express API server

  • / returns status: ok
  • /openai talks to OpenAI server with API key taken from Environment variable, and initiates a chat completions API call, with function added in tools, to get a path to navigate to in a frontend application
  • Unknown endpoints are handled in a middleware file.

Project Structure

src\
 |--routes\         # Routes
 |--utils\          # Utility files
 |--app.js          # Express app
 |--index.js        # App entry point

About

API Server running with Node, Express, Yarn, and Morgan.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%