Scaffolding and linting

This commit is contained in:
Manish 2023-03-28 02:57:53 +11:00
parent 8ec24d1733
commit f19df338ca
3 changed files with 16 additions and 15 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules node_modules
.env

View File

@ -2,29 +2,29 @@
// where your node app starts // where your node app starts
// init project // init project
require('dotenv').config(); require("dotenv").config();
var express = require('express'); var express = require("express");
var app = express(); var app = express();
// enable CORS (https://en.wikipedia.org/wiki/Cross-origin_resource_sharing) // enable CORS (https://en.wikipedia.org/wiki/Cross-origin_resource_sharing)
// so that your API is remotely testable by FCC // so that your API is remotely testable by FCC
var cors = require('cors'); var cors = require("cors");
app.use(cors({ optionsSuccessStatus: 200 })); // some legacy browsers choke on 204 app.use(cors({ optionsSuccessStatus: 200 })); // some legacy browsers choke on 204
// http://expressjs.com/en/starter/static-files.html // http://expressjs.com/en/starter/static-files.html
app.use(express.static('public')); app.use(express.static("public"));
// http://expressjs.com/en/starter/basic-routing.html // http://expressjs.com/en/starter/basic-routing.html
app.get('/', function (req, res) { app.get("/", function (req, res) {
res.sendFile(__dirname + '/views/index.html'); res.sendFile(__dirname + "/views/index.html");
}); });
// your first API endpoint... // your first API endpoint...
app.get('/api/hello', function (req, res) { app.get("/api/hello", function (req, res) {
res.json({ greeting: 'hello API' }); res.json({ greeting: "hello API" });
}); });
// listen for requests :) // listen for requests :)
var listener = app.listen(process.env.PORT || 3000, function () { var listener = app.listen(process.env.PORT || 3000, function () {
console.log('Your app is listening on port ' + listener.address().port); console.log("Your app is listening on port " + listener.address().port);
}); });

View File

@ -1,5 +1,5 @@
{ {
"name": "request-header-parser-microservice", "name": "@radii-fcc-backend/request-header-parser-microservice",
"version": "0.0.2", "version": "0.0.2",
"description": "API project for freeCodeCamp", "description": "API project for freeCodeCamp",
"main": "index.js", "main": "index.js",
@ -13,17 +13,17 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/freeCodeCamp/boilerplate-project-headerparser.git" "url": "https://radii.dev/freeCodeCamp.org-Back-End-Dev-and-APIs/headerparser.git"
}, },
"bugs": { "bugs": {
"url": "https://github.com/freeCodeCamp/freeCodeCamp/issues" "url": "https://radii.dev/freeCodeCamp.org-Back-End-Dev-and-APIs/headerparser/issues"
}, },
"homepage": "https://github.com/freeCodeCamp/boilerplate-project-headerparser#readme", "homepage": "https://fcc_backend_headerparser.radii.page/",
"author": "freeCodeCamp <team@freecodecamp.org>", "author": "Radii <fcc@radii.dev>",
"keywords": [ "keywords": [
"freeCodeCamp", "freeCodeCamp",
"node", "node",
"express" "express"
], ],
"license": "MIT" "license": "AGPL-3.0-or-later"
} }