Skip to content

Instantly share code, notes, and snippets.

View azamsharp's full-sized avatar

Mohammad Azam azamsharp

View GitHub Profile
import Leaf
try services.register(LeafProvider())
config.prefer(LeafRenderer.self, for: ViewRenderer.self)
import FluentPostgreSQL
try services.register(FluentPostgreSQLProvider())
/// Register the configured SQLite database to the database config.
var databases = DatabasesConfig()
let databaseConfig = PostgreSQLDatabaseConfig(hostname: "localhost", username: "postgres", database: "blog")
let database = PostgreSQLDatabase(config: databaseConfig)
<html>
<head>
</head>
<body>
Hello World
</body>
</html>
import Vapor
/// Register your application's routes here.
public func routes(_ router: Router) throws {
router.get("movies") { request in
return "movies"
}
}
import Vapor
/// Register your application's routes here.
public func routes(_ router: Router) throws {
router.get("movies") { request in
return "movies"
}
router.get("movies/fiction/1992") { request in
router.get("movies",String.parameter) { request -> String in
let genre = try request.parameters.next(String.self)
return "Movie with genre \(genre)"
}
@azamsharp
azamsharp / .swift
Created June 28, 2018 18:36
Siri Shortcuts Using UserActivity
//
// ViewController.swift
// NailasCoffee
//
// Created by Mohammad Azam on 6/28/18.
// Copyright © 2018 Mohammad Azam. All rights reserved.
//
import UIKit
import Intents
@azamsharp
azamsharp / .swift
Created June 29, 2018 16:50
Intent Handler
//
// IntentHandler.swift
// OrderCoffeeIntent
//
// Created by Mohammad Azam on 6/29/18.
// Copyright © 2018 Mohammad Azam. All rights reserved.
//
import Intents
const mongoose = require('mongoose')
// definining the schema for the dish
let dishSchema = mongoose.Schema({
name :String,
price : Number,
imageURL :String
})
const mongoose = require('mongoose')
let reviewSchema = mongoose.Schema({
title : String,
description :String,
dishId : mongoose.Schema.ObjectId
})
const Review = mongoose.model('Review',reviewSchema)