Chysev commited on
Commit
e0766bf
·
verified ·
1 Parent(s): 12d5fa2

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +3 -1
index.js CHANGED
@@ -1,10 +1,12 @@
1
  import express from "express"
2
  import { LlamaModel, LlamaContext, LlamaChatSession } from "node-llama-cpp"
3
  import path from "path"
 
4
 
5
  const app = express();
6
  const port = 7860;
7
 
 
8
 
9
  // Test Express API GET method with parameters
10
  app.get('/api/test', async (req, res) => {
@@ -17,7 +19,7 @@ app.get('/api/test', async (req, res) => {
17
  });
18
 
19
  // Test Express API POST method with variables
20
- app.post('/api/test', async (req, res) => {
21
  const reqData = req.body;
22
  const userInput = reqData.userInput;
23
 
 
1
  import express from "express"
2
  import { LlamaModel, LlamaContext, LlamaChatSession } from "node-llama-cpp"
3
  import path from "path"
4
+ import cors from "cors"
5
 
6
  const app = express();
7
  const port = 7860;
8
 
9
+ app.use(cors());
10
 
11
  // Test Express API GET method with parameters
12
  app.get('/api/test', async (req, res) => {
 
19
  });
20
 
21
  // Test Express API POST method with variables
22
+ app.post('/api/chat', async (req, res) => {
23
  const reqData = req.body;
24
  const userInput = reqData.userInput;
25