Created
April 11, 2013 19:29
-
-
Save DevJohnC/5366462 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace ProjectX.API.App_Start | |
| { | |
| public class AppHost | |
| : AppHostBase | |
| { | |
| public static OrmLiteConnectionFactory Database { get; set; } | |
| public AppHost() //Tell ServiceStack the name and where to find your web services | |
| : base("ProjectX Restful API", typeof(Services.ArtistService).Assembly) { } | |
| public override void Configure(Funq.Container container) | |
| { | |
| //Set JSON web services to return idiomatic JSON camelCase properties | |
| ServiceStack.Text.JsConfig.EmitCamelCaseNames = true; | |
| //Configure User Defined REST Paths | |
| Routes | |
| .Add<Services.Artist>("/artists", ApplyTo.Get) | |
| .Add<Services.ArtistEvents>("/artists_events/{artistId}", ApplyTo.Get) | |
| .Add<Services.Venues>("/venues", ApplyTo.Get) | |
| .Add<Services.VenuesEvents>("/venues_events/{venueId}", ApplyTo.Get) | |
| .Add<Events>("/events", ApplyTo.Get) | |
| .Add<EventDetails>("/events_details/{eventId}", ApplyTo.Get) | |
| .Add<EventFlags>("/eventflags", ApplyTo.Post) | |
| .Add<EventImageUrl>("/eventimageurl", ApplyTo.Post) | |
| .Add<Regions>("/regions", ApplyTo.Get) | |
| .Add<Services.Search>("/search", ApplyTo.Get) | |
| .Add<Services.Locate>("/locate", ApplyTo.Get) | |
| .Add<DTOs.FacebookLogin>("/login/facebook", ApplyTo.Get) | |
| .Add<DTOs.LiveFMLogin>("/login/local", ApplyTo.Get) | |
| .Add<DTOs.RenewSession>("/renew_session", ApplyTo.Get) | |
| .Add<DTOs.UserEventsCRUD>("/user/events", ApplyTo.Post | ApplyTo.Delete) | |
| .Add<DTOs.UserArtistsCRUD>("/user/artists", ApplyTo.Post | ApplyTo.Delete) | |
| .Add<DTOs.UserVenuesCRUD>("/user/venues", ApplyTo.Post | ApplyTo.Delete) | |
| .Add<DTOs.CreateLiveFMAccount>("/user/create", ApplyTo.Post) | |
| ; | |
| //Uncomment to change the default ServiceStack configuration | |
| SetConfig(new EndpointHostConfig { | |
| DebugMode = true, //Show StackTraces when developing | |
| AllowJsonpRequests = false | |
| }); | |
| } | |
| public static void Start() | |
| { | |
| new AppHost().Init(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment