Skip to content

Commit

Permalink
changing ports to 8080
Browse files Browse the repository at this point in the history
  • Loading branch information
SandraRodgers committed Jul 26, 2023
1 parent a5e982d commit 6e18c5c
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Starter-01/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ COPY --from=build /app/src/config.json ./src/config.json
COPY --from=build /app/server.js .
COPY --from=build /app/api-server.js .

EXPOSE 3000
EXPOSE 3001
EXPOSE 8080
EXPOSE 8080

ENV SERVER_PORT=3000
ENV API_PORT=3001
ENV SERVER_PORT=8080
ENV API_PORT=8080
ENV NODE_ENV production

CMD ["npm", "run", "prod"]
4 changes: 2 additions & 2 deletions Starter-01/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Copy the code from `config.json.example` and create a new file called `config.js

#### Run the application

The `dev` script will run a web and API server concurrently. Once running, you can [access the application in your browser](http://localhost:3000/).
The `dev` script will run a web and API server concurrently. Once running, you can [access the application in your browser](http://localhost:8080/).

```bash
npm run dev
Expand Down Expand Up @@ -74,5 +74,5 @@ docker build -t deepgram-javascript-01 .
Run the docker image.

```sh
docker run --init -p 3000:3000 -p 3001:3001 -it deepgram-javascript-01
docker run --init -p 8080:8080 -p 8080:8080 -it deepgram-javascript-01
```
7 changes: 4 additions & 3 deletions Starter-01/api-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ const cors = require("cors");
const express = require("express");
const multer = require("multer");

const appPort = process.env.SERVER_PORT || 3000;
const port = process.env.API_PORT || 3001;
const appPort = process.env.SERVER_PORT || 8080;
const port = process.env.API_PORT || 8080;
const appOrigin = config.appOrigin || `http://localhost:${appPort}`;

const deepgram = new Deepgram(config.dgKey, "api.beta.deepgram.com");
const storage = multer.memoryStorage();
const upload = multer({ storage: storage });

const app = express();
app.use(cors({ origin: appOrigin }));
app.use(cors());

app.post("/api", upload.single("file"), async (req, res) => {
const { body, file } = req;
Expand Down Expand Up @@ -44,6 +44,7 @@ app.post("/api", upload.single("file"), async (req, res) => {
const transcription = await deepgram.transcription.preRecorded(dgRequest, {
...dgFeatures,
model,
tier,
...(version ? { version } : null),
...(model === "whisper" ? null : { tier }),
});
Expand Down
2 changes: 1 addition & 1 deletion Starter-01/exec.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
docker build --rm -t deepgram-javascript-01 .
docker run --init -p 3000:3000 -p 3001:3001 -it deepgram-javascript-01
docker run --init -p 8080:8080 -p 8080:8080 -it deepgram-javascript-01
2 changes: 1 addition & 1 deletion Starter-01/exec.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
docker build -t deepgram-javascript-01 .
docker run --init -p 3000:3000 -p 3001:3001 -it deepgram-javascript-01
docker run --init -p 8080:8080 -p 8080:8080 -it deepgram-javascript-01
2 changes: 1 addition & 1 deletion Starter-01/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const express = require("express");
const { join } = require("path");
const app = express();

const port = process.env.SERVER_PORT || 3000;
const port = process.env.SERVER_PORT || 8080;

app.use(express.static(join(__dirname, "build")));
app.listen(port, () => console.log(`Server listening on port ${port}`));
6 changes: 3 additions & 3 deletions Starter-01/src/components/Demos.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ function classNames(...classes) {

const models = [
{
model: "general-beta",
model: "general",
name: "Deepgram Nova",
tier: "enhanced",
tier: "nova",
},
{
model: "whisper",
Expand Down Expand Up @@ -130,7 +130,7 @@ export default function Demos() {
const [file, setFile] = useState();
const [url, setUrl] = useState(files[0].value);

const apiOrigin = "http://localhost:3001";
const apiOrigin = "http://localhost:8080";

const onSubmitHandler = async (e) => {
setError();
Expand Down

0 comments on commit 6e18c5c

Please sign in to comment.