initial commit

parents
MONGO_URL='mongodb://localhost:27017'
PORT='3000'
\ No newline at end of file
node_modules
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
{
"name": "backend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"mongoose": "^7.0.1",
"multer": "^1.4.5-lts.1",
"ts-node-dev": "^2.0.0"
},
"devDependencies": {
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/mongoose": "^5.11.97",
"@types/multer": "^1.4.7"
}
}
\ No newline at end of file
import express, {Express, json} from 'express';
import 'dotenv/config';
import cors from 'cors';
import {connect} from 'mongoose';
const app: Express = express();
app.use(json());
app.use(cors());
const run = async () => {
await connect(`${process.env.MONGO_URL}/musicApp`);
};
run().catch((err) => console.log(err));
app.listen(process.env.PORT, () => {
console.log('Server started on port ' + process.env.PORT);
});
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment