Spaces:
Paused
Paused
Download server.js from arabdullah/chatty: direct link, hf CLI and curl.
- Browser
- Download file 694 Bytes
-
https://huggingface.co/spaces/arabdullah/chatty/resolve/main/server.js
- Command line
-
hf download hf://spaces/arabdullah/chatty/server.js
-
curl -L -o server.js https://huggingface.co/spaces/arabdullah/chatty/resolve/main/server.js
694 Bytes
| const express = require("express"); | |
| const path = require("path"); | |
| const dotenv = require("dotenv"); | |
| const mongoose = require("mongoose"); | |
| const app = require("./app"); | |
| dotenv.config({ path: "./.env" }); | |
| // Connect database | |
| mongoose | |
| .connect(process.env.MONGO_URI) | |
| .then(() => console.log("Database connected...")) | |
| .catch((error) => console.log("An error occured...")); | |
| // Serve client folder | |
| app.use(express.static(path.join(__dirname, "client", "build"))); | |
| app.get("*", (req, res) => { | |
| res.sendFile(path.join(__dirname, "client", "build", "index.html")); | |
| }); | |
| // Listen to port | |
| exports.expressServer = app.listen(process.env.PORT || 4000, () => | |
| console.log("Listening...") | |
| ); | |