Skip to content

Instantly share code, notes, and snippets.

Avatar
🐌
Not only working software but also well crafted software.

Dattatray Kale way2datta

🐌
Not only working software but also well crafted software.
View GitHub Profile
@way2datta
way2datta / well-formatted-and-readable
Last active Nov 21, 2018
Well formatted readable urls
View well-formatted-and-readable
HTTP POST http://localhost:3000/login
HTTP POST http://localhost:3000/authorize
HTTP POST http://localhost:3000/register
HTTP GET http://localhost:3000/users
HTTP GET http://localhost:3000/users/:id
HTTP DELETE http://localhost:3000/users/:id
HTTP PUT http://localhost:3000/users/:id
HTTP POST http://localhost:3000/users
HTTP GET http://localhost:3000/users/:id/expenses/categories
HTTP GET http://localhost:3000/users/:id/expenses/categories/:categoryId
@way2datta
way2datta / Route-expense-tracker-before.js
Last active Nov 21, 2018
Route-expense-tracker-before.js
View Route-expense-tracker-before.js
import { Router } from 'express';
import { LoginController } from '../controllers/loginController';
import { AuthController } from "../controllers/authController";
import { UserController } from "../controllers/userController";
import { ExpenseCategoryController } from "../controllers/expenseCategoryController";
import { ExpenseController } from "../controllers/expenseController";
const router = Router();
const loginController = new LoginController();
@way2datta
way2datta / Route-expense-tracker-after.js
Last active Nov 21, 2018
Well formatted readable urls for rest api's
View Route-expense-tracker-after.js
import { Router } from 'express';
import { LoginController } from '../controllers/loginController';
import { AuthController } from "../controllers/authController";
import { UserController } from "../controllers/userController";
import { ExpenseCategoryController } from "../controllers/expenseCategoryController";
import { ExpenseController } from "../controllers/expenseController";
const router = Router();
const loginController = new LoginController();
View expense-tracker-routes.js
const express = require('express');
const app = express();
const port = 3000;
app.get('/', (request, response) => response.send('Hello World!'));
app.get('/users', (request, response) => response.send("Get users"));
app.get('/users/:id', (request, response) => response.send("Get user by id"));
View code-retreat-second-round-extract-method.cs
using System;
using System.Collections.Generic;
namespace NMart.Billing
{
internal class NMartStore
{
private static Dictionary<string, int> CategoryGstRatesInPercentage = new Dictionary<string, int>();
private static Dictionary<string, string> ItemsInCategory = new Dictionary<string, string>();
View code-retreat-first-round-after-meaningful_names.cs
using System;
using System.Collections.Generic;
namespace NMart.Billing
{
internal class NMartStore
{
private static Dictionary<string, int> CategoryGstRatesInPercentage = new Dictionary<string, int>();
private static Dictionary<string, string> ItemsInCategory = new Dictionary<string, string>();
View code-retreat-first-round.cs
using System;
using System.Collections.Generic;
using System.Linq;
namespace Assignment
{
internal class Program
{
private static Dictionary<string, int> CGR = new Dictionary<string, int>();
private static Dictionary<string, string> iCat = new Dictionary<string, string>();