initial commit

This commit is contained in:
Ritesh Ghosh
2023-08-01 13:09:50 +05:30
commit 35e61131b3
9 changed files with 1509 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
APP_SRC_USER_AGENT= #user agent header
APP_SRC_ACCEPT_HEADER= #accept header
APP_SRC_BASE_URL= #src base url
APP_SRC_HOME_URL= #src home page url
APP_SRC_SEARCH_URL= #src search url
APP_SRC_AJAX_URL= #src ajax url
+3
View File
@@ -0,0 +1,3 @@
node_modules
.env
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Ritesh Ghosh
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+1
View File
@@ -0,0 +1 @@
zoro.to-api
+23
View File
@@ -0,0 +1,23 @@
import express from "express";
import { config } from "dotenv";
import morgan from "morgan";
import createHttpError from "http-errors";
config();
const app = express();
const PORT = Number(process.env.PORT) || 4000;
app.use(morgan("dev"));
app.get("/", (req, res) => {
res.json("hi there");
});
app.use((req, res, next) => next(createHttpError.NotFound()));
const errorHandler = (error, req, res, next) => {
const status = error?.status || 500;
res.status(status).json({
status,
message: error?.message || "Something Went Wrong",
});
};
app.use(errorHandler);
app.listen(PORT, () => {
console.log(`⚔ api @ http://localhost:${PORT}`);
});
+1340
View File
File diff suppressed because it is too large Load Diff
+42
View File
@@ -0,0 +1,42 @@
{
"name": "zoro.to-api",
"version": "1.0.0",
"description": "",
"main": "dist/server.js",
"type": "module",
"scripts": {
"start": "node dist/server.js",
"dev": "nodemon src/server.ts",
"build": "tsc -p tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ghoshRitesh12/zoro.to-api.git"
},
"bugs": {
"url": "https://github.com/ghoshRitesh12/zoro.to-api/issues"
},
"homepage": "https://github.com/ghoshRitesh12/zoro.to-api#readme",
"keywords": [
"anime",
"zoro"
],
"author": "https://github.com/ghoshRitesh12",
"license": "MIT",
"dependencies": {
"dotenv": "^16.3.1",
"express": "^4.18.2",
"http-errors": "^2.0.0",
"morgan": "^1.10.0"
},
"devDependencies": {
"@types/express": "^4.17.17",
"@types/http-errors": "^2.0.1",
"@types/morgan": "^1.9.4",
"@types/node": "^20.4.5",
"nodemon": "^3.0.1",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
}
}
+37
View File
@@ -0,0 +1,37 @@
import express, {
Request,
Response,
NextFunction,
ErrorRequestHandler,
Application,
} from "express";
import { config } from "dotenv";
import morgan from "morgan";
import createHttpError from "http-errors";
config();
const app: Application = express();
const PORT: number = Number(process.env.PORT) || 4000;
app.use(morgan("dev"));
app.get("/", (req: Request, res: Response) => {
res.json("hi there");
});
app.use((req: Request, res: Response, next: NextFunction) =>
next(createHttpError.NotFound())
);
const errorHandler: ErrorRequestHandler = (error, req, res, next) => {
const status = error?.status || 500;
res.status(status).json({
status,
message: error?.message || "Something Went Wrong",
});
};
app.use(errorHandler);
app.listen(PORT, () => {
console.log(`⚔ api @ http://localhost:${PORT}`);
});
+35
View File
@@ -0,0 +1,35 @@
{
"compilerOptions": {
/* Language and Environment */
"target": "ESNext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
/* Modules */
"module": "ESNext", /* Specify what module code is generated. */
"rootDir": "./src", /* Specify the root folder within your source files. */
"moduleResolution": "Node", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
/* Emit */
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
"removeComments": true, /* Disable emitting comments. */
/* Interop Constraints */
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
/* Type Checking */
"strict": true, /* Enable all strict type-checking options. */
"strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
/* Completeness */
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
"skipLibCheck": true /* Skip type checking all .d.ts files. */
},
"include": [
"./src"
],
"ts-node": {
"esm": true
},
"exclude": [
"node_modules",
],
}