Commit 5a7e3a14 authored by Sandeep Fernando's avatar Sandeep Fernando

created api setup

parent 7582cf33
# node_modules
node_modules
\ No newline at end of file
const express = require("express");
const cors = require("cors");
const helmet = require("helmet");
const compression = require("compression");
const app = express();
const port = process.env.PORT || 5000;
app.use(cors());
app.use(helmet());
app.use(compression());
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.get("*", (req, res) => {
res.status(200).send("garbage api is online.");
});
app.listen(port, () => {
console.log("garbage api is online.");
});
{
"verbose": false,
"ignore": [],
"execMap": {},
"watch": ["./index.js"]
}
\ 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": "api",
"version": "1.0.0",
"description": "REST API for Garbage",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon"
},
"keywords": [
"rest",
"api",
"garbage"
],
"author": "all",
"license": "ISC",
"devDependencies": {
"nodemon": "^2.0.7"
},
"dependencies": {
"compression": "^1.7.4",
"cors": "^2.8.5",
"express": "^4.17.1",
"helmet": "^4.6.0",
"mongoose": "^5.12.7"
}
}
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